0

我想管理我网站的网址

现在它向我展示 www.computermall.co.in/product_details.php?prdid=34

但我想要 www.computermall.co.in/product_details/34

我该怎么做?

我试过这个

Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteBase /computermall

# Get the URI-path directly from THE_REQUEST variable
RewriteCond %{THE_REQUEST} ^(GET|HEAD)\s/(.*)\.php [NC]
# Strip the extension and redirect permanently
RewriteRule  .*   /%2   [R=301,L,NC]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !\.php  [NC]
# Map internally to the original resource
RewriteRule ^(.*)$ $1.php [L,QSA] 
4

2 回答 2

0

尝试这个:

RewriteEngine On
RewriteRule ^product_details/prdid/([^/]*)$ /product_details?prdid=$1 [L]

编辑:删除前导斜杠

于 2013-07-11T04:52:06.833 回答
0

首先,您RewriteBase /computermall令人困惑,但我假设那是因为您的域位于另一个活动域/http 服务器路径的子目录中。

这是你的htaccess

RewriteBase /
RewriteRule ^computermall/product_details/([^/]*)/([^/]*$ /computermall/product_details?prdid=$2 [R=301,L]
于 2013-07-11T04:53:05.370 回答