Apache 如何更改url中的子字符串和重定向?
我希望始终以这种方式加载我的页面:Apache 如何更改url中的子字符串和重定向?,apache,.htaccess,Apache,.htaccess,我希望始终以这种方式加载我的页面: http://myhost/options=mymodule or: http://myhost/options=mymodule?(...) something 但该系统还有其他模块: http://myhost/options=othermodule or http://myhost/options=othermodule?(...) something 我希望总是重定向到我的模块。如何执行此操作?在htaccess文件或apache配置文件中
http://myhost/options=mymodule
or:
http://myhost/options=mymodule?(...) something
但该系统还有其他模块:
http://myhost/options=othermodule
or
http://myhost/options=othermodule?(...) something
我希望总是重定向到我的模块。如何执行此操作?在htaccess文件或apache配置文件中
RewriteEngine On
RewriteRule /options=othermodule(.*) /options=mymodule$1
答案是:
RewriteEngine on
RewriteCond %{QUERY_STRING} !(^|&)options=mymodule(&|$)
RewriteRule ^(.*)$ index.php?options=mymodule [L]
Nips:你想将所有内容重定向到我的模块吗?是的,我想将每个页面重定向到我的模块