htaccess重定向链接

时间:2012-08-16 14:21:00

标签: .htaccess redirect

我试过谷歌,很多教程,但仍然有一些问题,重定向一些链接。也许我的实际htaccess会产生一些冲突?

试图例如

RewriteCond %{REQUEST_URI} ^/kanaly_rss
RewriteRule rss\.php\?kat=(.*) /rss/$1 [R,L]

任何其他组合。

我想重定向链接: kanaly_rss / rss.php?吉= XXX

RSS / XXX

我的.htaccess:

选项+ FollowSymLinks + ExecCGI

<IfModule mod_rewrite.c>
 RewriteEngine On
  RewriteBase /

  RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
  RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

  # we skip all files with .something
  #RewriteCond %{REQUEST_URI} \..+$
  #RewriteCond %{REQUEST_URI} !\.html$
  #RewriteRule .* - [L]

  # redirect old links
  RewriteCond %{REQUEST_URI} !redirected_oldlink
  RewriteCond %{QUERY_STRING} co=
  RewriteRule (.*) /redirected_oldlink.php?%{QUERY_STRING} [L]

  RewriteCond %{THE_REQUEST} ^.*\/index\.php/?\ HTTP/
  RewriteRule ^(.*)index\.php/?$ "/$1" [R=301,L]

  # we check if the .html version is here (caching)
  RewriteRule ^$ index.html [QSA]
  RewriteRule ^([^.]+)$ $1.html [QSA]
  RewriteCond %{REQUEST_FILENAME} !-f

  # no, so we redirect to our front web controller
  RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

1 个答案:

答案 0 :(得分:0)

尝试添加以下两行:

RewriteCond %{QUERY_STRING} ^(.*&)?kat=([^$]*)&?
RewriteRule ^kanaly_rss/rss.php /rss/%2? [L,R=301]