0
我在我的.htaccess中做了一些重定向的东西,它工作安静。.htaccess重写更改错误url
RewriteEngine On
# add www. if missing
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
# redirect index.html and index.php to the simple homepage
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\|/index\.html\ HTTP/
RewriteRule ^index\.php$|^index\.html$ http://www.example.com/ [R=301,L]
# add trailing slash if missing
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*[^/]$ /$0/ [L,R=301]
# redirect simulated directories to php files of the same name in /content/
RewriteCond %{REQUEST_URI} !^(\/css|\/images) [NC]
RewriteRule ^([^/]+)/$ content/$1\.php?rw=1 [QSA,L]
RewriteCond %{QUERY_STRING} !^rw=1
RewriteRule ^content/([^/]+).php$ /$1/ [R=301,L]
不过,虽然添加尾随斜线部分启用有使用URL一个奇怪的问题不存在,并且是针对我的404错误页面: 例如,如果我进入www.example。 com/notexisting /那个URL被转换为www.example.com/content/notexisting.php/?rw=1 当我禁用尾部斜线部分或htaccess中模拟目录的部分时,不会发生这种情况。但我想保留两者。有没有可能?
完美!而已!非常感谢。 – konraed