Htaccess:重定向确定,但重写不起作用

时间:2017-04-12 07:47:58

标签: apache .htaccess redirect mod-rewrite url-rewriting

我只是简单地重写规则:

# Evenements URL rewrite
RewriteRule ^agenda/evenement/([^/]+)-([0-9]+)$ agenda/evenement/?idEvent=$2&title=$1 [R=302,QSA,L]
RewriteRule ^en/agenda/evenement/([^/]+)-([0-9]+)$ en/agenda/evenement/?idEvent=$2&title=$1 [R=302,L]
RewriteRule ^en/calendar/event/([^/]+)-([0-9]+)$ en/calendar/event/?idEvent=$2&title=$1 [R=302,L]

这很好。但我想重写,而不是重定向。如果我删除R = 302,我会自动获得404。知道为什么吗?

这里是完整的区块,看看我的规则是否在错误的位置(我试图移动它们)

<IfModule mod_rewrite.c>
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
# Evenements URL rewrite
RewriteRule ^agenda/evenement/([^/]+)-([0-9]+)$ agenda/evenement/?idEvent=$2&title=$1 [R=302,QSA,L]
RewriteRule ^en/agenda/evenement/([^/]+)-([0-9]+)$ en/agenda/evenement/?idEvent=$2&title=$1 [R=302,L]
RewriteRule ^en/calendar/event/([^/]+)-([0-9]+)$ en/calendar/event/?idEvent=$2&title=$1 [R=302,L]
RewriteRule . index.php [L]
</IfModule>

谢谢!

0 个答案:

没有答案