RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /webfolder/index.php/$1 [L]
我怎样才能重定向我的网址,即
www.example.com/webfolder
至
example.com/webfolder/keyword
没有搞砸上面的重写?
根据http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html它应该是这样的:
RewriteEngine On
RewriteCond %{HTTP_HOST} www.example.com
RewriteRule ^webfolder/(.*) http://example.com/webfolder/$1 [L,R=301]
RewriteRule ^webfolder$ http://example.com/webfolder/ [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /webfolder/index.php/$1 [L]
index.php 应该在,/webfolder/
否则你会得到错误 500