Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache 如何更改url中的子字符串和重定向?_Apache_.htaccess - Fatal编程技术网

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:你想将所有内容重定向到我的模块吗?是的,我想将每个页面重定向到我的模块