.htaccess url重写但没有任何反应

时间:2015-01-07 19:25:59

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

我目前正试图通过编写我的.htaccess来重写我的新网站的网址。我完成了3种不同场景的重定向和基因。

网址没有重定向到好网址。

将此网址“http://domain.dk/?fag=1&id=87”重写为:“http://domain.dk/fag/1/id/87

将此网址“http://domain.dk/?fag=1”重写为:“http://domain.dk/fag/1/

将此网址“http://domain.dk/?id=87”重写为:“http://domain.dk/id/87

我的代码是

Options +FollowSymLinks

RewriteEngine On

RewriteBase /

RewriteCond %{HTTP_HOST} ^www\.domain\.dk$ [NC]

ErrorDocument 400 /?fejl=400

ErrorDocument 401 /?fejl=401

ErrorDocument 403 /?fejl=403

ErrorDocument 404 /?fejl=404

ErrorDocument 500 /?fejl=500

RewriteRule fag/(.*)/aflevering/(.*)/ index.php?fag=$1&id=$2
RewriteRule fag/(.*)/ index.php?fag=$1
RewriteRule aflevering/(.*)/ index.php?id=$2

1 个答案:

答案 0 :(得分:0)

您需要将AllowOverride指令设置为All for the container