我有以下链接:
http://***.com/page.php?g=TWD
但我想更改此链接:
http://***.com/TWD
问题是我需要为index.php等其他网页做些什么?
这是我的.htaccess代码:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ page.php?g=$1 [L]
Options -Indexes
感谢。
答案 0 :(得分:0)
以下内容应该可以让您实现这一目标。
RewriteEngine On
RewriteCond %{THE_REQUEST} ^(GET|POST)\ /page\.php\?g=(.*)\ HTTP
RewriteRule ^page.php /%2? [R,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [L]
#Internal rewrite
RewriteRule ^([a-zA-Z0-9]+)$ /page.php?g=$1 [L]
http://***.com/page.php?g=TWD
将更改为http://***.com/TWD