【发布时间】:2019-02-13 23:06:14
【问题描述】:
我想重写这个网址:
https://example.com/super/index.php?route=doo/math&user_token=AxDJFKDLS73jfd
进入这个网址:
https://example.com/super/math&user_token=AxDJFKDLS73jfd
甚至是这个:
https://example.com/super/user_token=AxDJFKDLS73jfd
我尝试了不同的方法,通过修改 /super 目录中的 .htaccess 并添加:
RewriteEngine On
RewriteRule ^super/$ index.php?route=doo/math [L]
也试过了:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^route=doo/math([^&]+)&?(.*)$
RewriteRule ^/?$ /%1?%2 [R,L]
也可以直接在 apache vhost 中添加:
<IfModule mod_rewrite.c>
RewriteCond %{QUERY_STRING} ^(.*)&route=([0-9]{10,12})(?:&)(.*)$
RewriteRule ^(.*)$ https://%{SERVER_NAME}/super/$1?%1/%2\?%3 [NE,L,R]
</IfModule>
很遗憾,这些方法都不起作用,非常感谢您的帮助。
【问题讨论】:
标签: apache .htaccess mod-rewrite url-rewriting url-rewrite-module