How to use htaccess to redirect all address for a folder?
Can some one he开发者_C百科lp me modify this code. I am not sure how to modify htaccess.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule (some_folder/.*) $1 [L] # adjust the regex to what you want.
# normal cake rules
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
I wanna redirect all address blog/* to blog/
You probably want:
RewriteRule ^blog/?(.*)$ blog/ [L]
I'm not sure why you'd want to ignore part of the URL though. Do you want to force the address to blog/ instead of a transparent redirect? Use [R] instead of [L]
To override CakePHP redirects, you could try inserting:
RewriteRule ^/blog(/?.*)$ /blog$1 [L]
before
RewriteRule (.*) webroot/$1 [L]
精彩评论