简体   繁体   English

mod_rewrite不会重定向到我的内部网址

[英]mod_rewrite does not redirect to my internal url

i'm trying to solve a mod_rewrite rule for my webshop. 我正在尝试为我的网店解决mod_rewrite规则。

The URL is: localhost/myshop/category1/category2/myproduct.html URL为: localhost/myshop/category1/category2/myproduct.html

The rediret URLshould be: localhost/myshop/configurator/product/configure/id/1/s/myproduct/category1/5/ 重定向URL应该是: localhost/myshop/configurator/product/configure/id/1/s/myproduct/category1/5/ myshop localhost/myshop/configurator/product/configure/id/1/s/myproduct/category1/5/

If I try a RewriteRule like this 如果我尝试像这样的RewriteRule

RewriteRule ^myproduct\.html$ http://localhost/myshop/configurator/product/configure/id/1/s/myproduct/category1/5/

nothing happens and the redirect will not appear. 没有任何反应,重定向也不会出现。

What i'm doing wrong? 我做错了什么?

my rewrite rules in .htaccess 我在.htaccess中的重写规则

RewriteBase /myshop/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L]
RewriteRule ^myproduct\.html$ http://localhost/myshop/configurator/product/configure/id/1/s/myproduct/category1/5/

I want that myproduct.html redirects immediatly to the configurator link, so i want to implement a RewriteRule 我希望myproduct.html立即重定向到配置器链接,所以我想实现一个RewriteRule

Try re-ordering your rules: 尝试重新订购您的规则:

RewriteEngine On

RewriteBase /myshop/

RewriteRule (^|/)myproduct\.html$ /myshop/configurator/product/configure/id/1/s/myproduct/category1/5/ [L,NC]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM