0

ホームページのURLを管理したい

今、それは私にwww.computermal.co.in/product_details.php?prdid=34を示しています

しかし、私はwww.computermal.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 に答える