可能重复:
.htaccess php Rewrite
我想从页面进行重定向:
http://www.bb.com/order/a
到
http://www.bb.com/order?val=a
我该怎么做?
UPD。用户将通过第一个链接询问服务器,但响应将通过第二个链接。
UPD2。
RewriteEngine On
RewriteBase /
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^order/(.*)$ order?val=$1 [R, L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
答案 0 :(得分:2)
使用此.htaccess
RewriteEngine On
RewriteBase /
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^order/(.*)$ order?val=$1 [R, L]
如果您不想重定向但重写使用[PT, L]
而不是[R, L]