这可能是关于 RewriteRule 的一个基本问题,但我无法让它发挥作用。
我想要做的是检测像这样的网址:
mydomain/myapp/id/some/random/url.html?param=somethingThatIdoUse
mydomain/myapp/id/other/randomabc/perrito.php?param=somethingThatIdoUse
...
我需要删除的部分来自/id/[all this]?param=somethingIdoUse
并使用参数,如果可能的话,或者将完整的 url 作为参数发送,这样我就可以通过正则表达式来获取参数。
并有一个规则来检测/id/
存在并重定向到类似的东西:
mydomain/myapp/other/manageRequest.php?params=somethingThatIdoUse
(我可以获得整个网址并将其剥离为字符串的参数没问题)
该应用程序还具有不同的模块,例如:
mydomain/myapp/moduleOne/index.php
mydomain/myapp/moduleTwo/index.php
这必须保持不变。
到目前为止,我已经尝试过其中一些,例如:
RewriteEngine On
RewriteCond %{THE_REQUEST} ^GET /.*;.* HTTP/
RewriteCond %{QUERY_STRING} !^$
RewriteRule .* http://localhostdev/app/index.php %{REQUEST_URI}? [R=301,L]
RewriteEngine On
RewriteBase /spt/
RewriteCond %{REQUEST_FILENAME} !^id$ [NC]
RewriteRule ^(.*)$ index.php [R=301,L]
RewriteEngine On
RewriteCond %{REQUEST_URI} !/campaings/response\.php$
RewriteRule ^/something/(.*) /other/manageRequest.php? [L]
但是没有什么可以做我需要的。
谢谢指教