【发布时间】:2012-05-15 07:44:09
【问题描述】:
我安装了 SocialEngine 来替换旧的 CMS。问题是搜索引擎中存在许多旧 URL。我想将它们重定向到当前网站的相应网址(因为此时它们只重定向到首页)。
我的旧 CMS 的所有内容都已导入 SE,因此每个旧页面现在都有对应的内容。 例如 : 旧地址:/index.php?mod=news&ac=commentaires&id=367 新地址:/articles/367
我尝试在我的 .htaccess 中添加类似:
redirectmatch 301 index.php?mod=news&ac=commentaires&id=([0-9]+) http://www.nailissima.fr/articles/$1
但它不起作用。当我输入旧地址时,它仍然重定向到主页,而不是相应的文章。
你能帮我解决这个问题吗?
这是我的 .htaccess :
# $Id: .htaccess 7539 2010-10-04 04:41:38Z john $
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
# Get rid of index.php
RewriteCond %{REQUEST_URI} /index\.php
RewriteRule (.*) index.php?rewrite=2 [L,QSA]
# Rewrite all directory-looking urls
RewriteCond %{REQUEST_URI} /$
RewriteRule (.*) index.php?rewrite=1 [L,QSA]
# Try to route missing files
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} public\/ [OR]
RewriteCond %{REQUEST_FILENAME} \.(jpg|gif|png|ico|flv|htm|html|php|css|js)$
RewriteRule . - [L]
# If the file doesn't exist, rewrite to index
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?rewrite=1 [L,QSA]
</IfModule>
# sends requests /index.php/path/to/module/ to "index.php"
# AcceptPathInfo On
# @todo This may not be effective in some cases
FileETag Size
提前谢谢你!
最好的问候
【问题讨论】:
-
您可以在添加规则的地方发布您编辑的 htaccess 吗?
标签: .htaccess redirect socialengine