2016-12-13 88 views
3

我必须更改子页面的名称,现在问题是Facebook,Twitter等上的所有共享链接不再工作。用.htaccess替换部分URL

这就是为什么我试图重定向只有一部分的网址与.htaccess,但我还没有解决方案。

它应该是这样的:

www.mydomain.com/feeds/details/ --> www.mydomain.com/highlights/details/ 

我希望你能帮帮我!

+0

的[文件夹重定向到另一个htaccess的]可能的复制(http://stackoverflow.com/questions/18998608/redirect -folder-to-another-with-htaccess) –

回答

3

这将取决于你的服务器上,但你正在寻找的东西沿着这些路线

//Rewrite to www 
Options +FollowSymLinks 
RewriteEngine on 
RewriteCond %{HTTP_HOST} ^example.com[nc] 
RewriteRule ^(.*)$ http://www.example.com/$1 [r=301,nc] 

//301 Redirect Entire Directory 
RedirectMatch 301 /feeds(.*) /highlights/$1 
+1

感谢它与RedirectMatch合作! –

0

您可以尝试使用重写的RewriteRule URL,就像如下:

的.htaccess

RewriteEngine on 
RewriteRule ^/feeds/details$ /highlights/details/ 

希望,为你工作。

你可以找到更多的信息here