简体   繁体   中英

mod_rewrite does not redirect to my internal url

i'm trying to solve a mod_rewrite rule for my webshop.

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

The rediret URLshould be: localhost/myshop/configurator/product/configure/id/1/s/myproduct/category1/5/

If I try a RewriteRule like this

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

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

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]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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