htaccess代码无法正常工作,并显示带参数的完整网址

时间:2014-08-22 14:57:39

标签: .htaccess

我正在尝试让我的网址用户友好,当我点击链接时我现在收到此网址domain.com/?category=about&page=about,我需要的是显示网址 domain.com/about仅限访问者。

我已编写代码,但无效。

这是ht访问代码

DirectoryIndex index.php
RewriteEngine on
RewriteRule ^(about|eshop|ecommerce|design|faq|contact)/$ index.php?category=$1&page=$1
RewriteRule ^index(\.php)? http://mywebi.co.il/ [R=301,C]

请查看网站here

请帮助我,

此致 Sushmitha Malhotra

1 个答案:

答案 0 :(得分:0)

你的规则如下:

DirectoryIndex index.php
RewriteEngine On

# remove index.php
RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^(.*?)index\.php$ /$1 [L,R=302,NC,NE]

# external redirection to get /about in browser
RewriteCond %{THE_REQUEST} \s/+index\.php\?category=([^\s&]+) [NC]
RewriteRule ^ /%1? [R=302,L]

# internal rewrite
RewriteRule ^(about|eshop|ecommerce|design|faq|contact)/?$ index.php?category=$1&page=$1 [L,QSA,NC]