我已经阅读了关于此主题的一些帖子和apache文档。
我想将网址hello/ola/ciao/page.php
转换为u/u/u/page.php
以隐藏网站逻辑。
如果我写:
RewriteRule ^hello/ola/ciao/(.*)$ u/u/u/$1 [R]
或
RewriteRule ^hello/ola/ciao/(.*)$ u/u/u/$1 [P]
它返回消息:
The requested URL /u/u/u/page.php was not found on this server
我的HTTPD.CONF是:
<Directory "C:/workspace">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
因此,我不希望重定向到u/u/u/page.php
,因为服务器上不存在u/u/u/
个文件夹。
我只想将网址转换为u/u/u/page.php
,让它更好。
答案 0 :(得分:0)
在根目录中尝试此规则
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^u/u/u/(.*).php$ hello/ola/ciao/$1.php [L]