我想管理我网站的网址
现在它向我展示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]
答案 0 :(得分:0)
试试这个:
RewriteEngine On
RewriteRule ^product_details/prdid/([^/]*)$ /product_details?prdid=$1 [L]
编辑:删除了前导斜杠
答案 1 :(得分:0)
首先,您的RewriteBase /computermall
令人困惑但我假设那里因为您的域位于另一个活动域/ http服务器路径的子目录中。
这是您的htaccess
RewriteBase /
RewriteRule ^computermall/product_details/([^/]*)/([^/]*$ /computermall/product_details?prdid=$2 [R=301,L]