开发者

How to use htaccess to redirect all address for a folder?

开发者 https://www.devze.com 2023-01-23 10:33 出处:网络
Can some one he开发者_C百科lp me modify this code. I am not sure how to modify htaccess. <IfModule mod_rewrite.c>

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]
0

精彩评论

暂无评论...
验证码 换一张
取 消