.htaccess不匹配
htaccess不匹配.htaccess不匹配,.htaccess,mod-rewrite,url-rewriting,get,apache2,.htaccess,Mod Rewrite,Url Rewriting,Get,Apache2,htaccess不匹配 RewriteCond %{REQUEST_URI} ^/catalog/products_in_scene.php?(.*)$ RewriteRule ^(.+) "/services/hpv/index.php?%1" RewriteCond %{REQUEST_URI} ^/shop/derivation_tree.php?(.*)$ RewriteRule
RewriteCond %{REQUEST_URI} ^/catalog/products_in_scene.php?(.*)$
RewriteRule ^(.+) "/services/hpv/index.php?%1"
RewriteCond %{REQUEST_URI} ^/shop/derivation_tree.php?(.*)$
RewriteRule ^(.+) "/services/dt/index.php?%1"
上面的一个匹配所有GET变量,第二个匹配并将我发送到正确的页面,但从未将GET变量发送给它;为什么?从重写规则中删除引用
如果它不起作用,这意味着您的php GET变量有问题。您最好使用[QSA]标志:
将代码更改为:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^catalog/products_in_scene\.php$ services/hpv/index.php [R,L,NC]
RewriteRule ^shop/derivation_tree\.php$ services/dt/index.php [R,L,NC]
我看不出有什么理由让它在第一时间起作用{REQUEST_URI}在您的案例中仅包含URL/catalog/products_中的路径部分。要匹配查询字符串,请在此处使用RewriteCond%{query\u string}PATTERN\u。但在任何情况下,若新URL并没有提供自己的查询字符串,那个么-查询字符串将原封不动地传递给新的目标。您始终可以使用[QSA]标志传递原始查询字符串。
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^catalog/products_in_scene\.php$ services/hpv/index.php [R,L,NC]
RewriteRule ^shop/derivation_tree\.php$ services/dt/index.php [R,L,NC]