简体   繁体   中英

Apache Rewrite How do I redirect url by replacing part of it?

Take this url for example:

 www.mysite.com/old/blablabla/some.html

I want to replace any request uri starting with /old/ with /new/old/ . Then that sample should be

 www.mysite.com/new/old/blablabla/some.html

I tried this but I got 404:

RewriteCond %{REQUEST_URI} ^/old/
RewriteRule ^/old/(.*)$ /new/old/$1 [L]

Just with this:

RewriteRule ^/old/(.*) /new/old/$1 [L]

but /new/old/blablabla/some.html has to exist phisicaly in your server path.

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