简体   繁体   中英

htaccess redirect dynamic old file to new File url

with the last update I had to change site folder and now old urls need to be redirected to the new path.. old was:

www.siteexamplename.com/store/index.php?product=240    

new is:

www.siteexamplename.com/shop/index.php?product=240

how to redirect via .htaccess to the new path.. just to rename store to shop - the rest is the same.. thanks

You need to use rewrite rule-

RewriteEngine on
RewriteRule ^oldDirectory/([a-zA-Z0-9-_.]+)$ /newDirectory/$1 [R=301,L]

In the root directory of your Website you need to create .htaccess file with next code:

<IfModule mod_rewrite.c>
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^store/(.*)$ /shop/$1 [L]
</IfModule>

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