Home URL Path depth reduction .htaccess
Reply: 1

URL Path depth reduction .htaccess

gyurielf
1#
gyurielf Published in 2018-02-09 16:35:20Z

We now reduce the depth of paths:

from https://example.com/en/products/i/dance-show-blabla/STUYXhzEYT

to https://example.com/en/dance-show-blabla/STUYXhzEYT

So, we using this htacces code:

RewriteRule ^(.+?)/(.+?)$ index.php?siteModule=$2

RewriteRule ^(.+?)/(.+?)/(.+?)$ index.php?siteModule=$2&pageController=$3

RewriteRule ^(.+?)/(.+?)/(.+?)/(.+?)$ index.php?siteModule=$2&pageController=$3&pageData=$4 [L]

Can it be solved more easily? Merge from 3 rule to 1?

Croises
2#
Croises Reply to 2018-02-09 22:43:12Z

If you can correctly interpret empty variables, you can use:

RewriteRule ^[^/]+/([^/]+)(?:/([^/]+))?(?:/([^/]+))?$ index.php?siteModule=$1&pageController=$2&pageData=$3 [L]
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.483906 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO