Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess SocialEngine-301旧站点页面重定向。htaccess_.htaccess_Redirect_Socialengine - Fatal编程技术网

.htaccess SocialEngine-301旧站点页面重定向。htaccess

.htaccess SocialEngine-301旧站点页面重定向。htaccess,.htaccess,redirect,socialengine,.htaccess,Redirect,Socialengine,我安装了SocialEngine以替换旧的CMS。问题是搜索引擎中存在很多旧的URL。我想将它们重定向到当前网站上相应的URL(因为此时它们只重定向到主页) 我的旧CMS的所有内容都被导入到SE中,所以每个旧页面现在都有它的等价物。 例如: 旧地址:/index.php?mod=news&ac=commentals&id=367 新地址:/articles/367 我尝试在.htaccess中添加如下内容: redirectmatch 301 index.php?mod=news&ac=

我安装了SocialEngine以替换旧的CMS。问题是搜索引擎中存在很多旧的URL。我想将它们重定向到当前网站上相应的URL(因为此时它们只重定向到主页)

我的旧CMS的所有内容都被导入到SE中,所以每个旧页面现在都有它的等价物。 例如: 旧地址:/index.php?mod=news&ac=commentals&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
#$Id:.htaccess 7539 2010-10-04 04:41:38Z john$
选项+FollowSymLinks
重新启动发动机
#去掉index.php
重写cond%{REQUEST_URI}/index\.php
RewriteRule(.*)index.php?rewrite=2[L,QSA]
#重写所有查找目录的URL
重写cond%{REQUEST_URI}/$
RewriteRule(.*)index.php?rewrite=1[L,QSA]
#尝试路由丢失的文件
重写cond%{REQUEST_FILENAME}-F
RewriteCond%{REQUEST_FILENAME}public\/[或]
重写cond%{REQUEST|u FILENAME}\(jpg | gif | png | ico | flv | htm | html | php | css | js)$
重写规则[L]
#如果文件不存在,请重写为索引
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php?重写=1[L,QSA]
#将请求/index.php/path/to/module/发送到“index.php”
#上的AcceptPathInfo
#@todo这在某些情况下可能无效
文件标签大小
提前谢谢你


致以最诚挚的问候

您可能对重定向指令的顺序有问题

首先用注释禁用所有当前的常规规则,然后单独尝试新的重定向

如果它们起作用,那么仔细想想应该把它们放在哪里

[五十] 在指令的末尾使其持续,因此如果此指令匹配,则不会进一步处理


使用这种方法,先写更详细的说明,然后再写更一般的说明,否则,当进一步的说明超出当前的范围时,您可能会遇到这种情况

谢谢你的快速回答!不幸的是,我试图禁用.htaccess的所有内容,并仅将redirectmatch代码放在第一行,即使这样也不起作用:网站的许多菜单和链接都已断开,但当我键入旧地址时,它仍会重定向到SocialEngine的主页,而不是相应的新页面:(您可以将您编辑的htaccess发布到添加规则的位置吗?