简体   繁体   中英

Htaccess 301 Redirection Error

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /webfolder/index.php/$1 [L]

How can i redirect my url ie

www.example.com/webfolder

to

example.com/webfolder/keyword

without screwing up the above re-write?

according to http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html it should be like this:

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 should be in /webfolder/ or you will get error 500

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM