簡體   English   中英

如何在htaccess中成功重定向?

[英]How do I make a success redirect in htaccess?

嗨,我嘗試在.htaccess中進行重定向,但沒有結果。

這是我的嘗試:

  1. RedirectMatch 301 www.magazinfermier.ro/index.php?route=product/category&path=35_49(.*) http://www.fermier.ro/profesionist/vinificatie/laborator//$1

不起作用

  1. Redirect 301 /index.php?route=product/category&path=35_49 http://www.fermier.ro/profesionist/vinificatie/laborator/

不起作用

我究竟做錯了什么 ? 提前

這是我的htaccess文件的內容:

Options +FollowSymlinks

<FilesMatch "\.(tpl|ini|log)">
 Order deny,allow
 Deny from all
</FilesMatch>

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

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

RewriteCond %{QUERY_STRING} ^route=product/category&path=35_49
RewriteRule ^index\.php$ /profesionist/vinificatie/laborator/? [L,NC,R=301]

這是舊主機: magazinfermier.ro ,這是新主機: fermier.ro

您不能使用RedirectMatch匹配查詢字符串。 在您的根.htaccess中使用mod_rewrite代替:

RewriteEngine On

RewriteCond %{QUERY_STRING} ^route=product/category&path=35_49
RewriteRule ^index\.php$ /profesionist/vinificatie/laborator/? [L,NC,R=301]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM