1
使用Joomla并试图停止使用JoomFish,但是当我们确实使用它时,其他网站链接到我们的页面为“basedomain.org/en/everypage”。现在这些链接转到404错误。我需要从所有网址中删除/ zh,想要使用.htaccess
如何使用.htaccess将basedomain.org/en/everypage的所有请求重写或重定向到basedomain.org/everypage?
使用Joomla并试图停止使用JoomFish,但是当我们确实使用它时,其他网站链接到我们的页面为“basedomain.org/en/everypage”。现在这些链接转到404错误。我需要从所有网址中删除/ zh,想要使用.htaccess
如何使用.htaccess将basedomain.org/en/everypage的所有请求重写或重定向到basedomain.org/everypage?
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteRule ^en/(.*)$ /$1 [L,R=302]
一旦你确定它的工作原理,改变302至301(301是很难调试,因为浏览器缓存它)
或者,使用RedirectMatch
(简单,无需启用RewriteEngine叙述):
RedirectMatch permanent /en/(.*) http://www.example.com/$1
(用自己的域名代替www.example.com)
的[重写的.htaccess重定向URL根到子目录]
可能重复(http://stackoverflow.com/questions/ 990392/htaccess的重写到重定向根-URL到子目录) –