httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yann Ylavic <ylavic....@gmail.com>
Subject Re: [users@httpd] .htaccess rule match keyword
Date Mon, 06 Feb 2017 14:22:24 GMT
Hi,

On Mon, Feb 6, 2017 at 11:34 AM, Rajib Karmakar
<creativeweblogo@gmail.com> wrote:
>
> RewriteRule ^cart(.*)$ cart.php
>
> https://www.berkshirefurniture.com/cart/
[]
>
> https://www.berkshirefurniture.com/carter-upholstered-bed/p/bmV3LWFycml2YWw=
>
> ## For showing leaf sub category of item
> RewriteCond %{REQUEST_URI} !^/([^/]*)/p
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteRule ^([^/]*)/([^/]*)/([^/]*)$
> leafsub-category-gallery.php?slug=$1&subcat=$2&leafsubcat=$3 [L,NC]
>
> First four letter of products url "carter" to "cart" matched with the cart
> page link and that's the reason it moved to the cart page.
>
> Is it possible using htaccess rewriting match the specific slug and forced
> not to redirect it's default rules i.e it matched the full slug and redirect
> to specific rule only.

Not sure what you mean, but as already suggested, why not avoid
matching anything but /cart or /cart/.* in the first place:
    RewriteRule ^cart(/|$) cart.php
?

And shouldn't the same principle also apply to the first RewriteCond:
   RewriteCond %{REQUEST_URI} !^/([^/]*)/p/
?


Regards,
Yann.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message