简体   繁体   English

301 htaccess将旧网址重定向到新网址

[英]301 htaccess redirect for old urls to new urls

I want to move all the URLs with this structure 我想使用此结构移动所有URL

domain.com/public/index.php/site/samepagename

to

domain.com/site/samepagename

can anyone help me with the .htaccess 谁能帮助我.htaccess

this is not duplicate of my previous issue. 这不是我上一期的重复。 This is new. 这是新的。

You can create .htaccess file and and add the below lines: 您可以创建.htaccess文件并添加以下行:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^public/index.php/([a-zA-Z0-9-]+)$ site/$1

OR 要么

Options +FollowSymlinks
RewriteEngine on
rewriterule ^public/index.php/samepagename(.*)$ http://domain.com/site/samepagename$1 [r=301,nc]

Please note that above is not tested. 请注意,以上内容未经测试。 Please test it locally before you deployed to production environment. 在部署到生产环境之前,请先在本地进行测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM