![](/img/trans.png)
[英]How to redirect old url to new url using .htaccess file in codeigniter?
[英]htaccess redirect dynamic old file to new File url
在上次更新中,我不得不更改站点文件夹,现在需要将旧网址重定向到新路径。
www.siteexamplename.com/store/index.php?product=240
新的是:
www.siteexamplename.com/shop/index.php?product=240
如何通过.htaccess重定向到新路径..只是将商店重命名为shop-其余相同..谢谢
您需要使用重写规则-
RewriteEngine on
RewriteRule ^oldDirectory/([a-zA-Z0-9-_.]+)$ /newDirectory/$1 [R=301,L]
在您网站的根目录中,您需要使用以下代码创建.htaccess文件:
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^store/(.*)$ /shop/$1 [L]
</IfModule>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.