You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Rajib Karmakar <cr...@gmail.com> on 2017/02/06 10:34:55 UTC

[users@httpd] .htaccess rule match keyword

Hi,

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.

Sincerely
---------------------------------------------------------
Rajib Karmakar

Creative Web Logo Technologies
Website: http://www.creativeweblogo.com
Mobile: +919874704940
Skype: creative.web.logo
© 2008-2017 Creative Web Logo Technologies.

Re: [users@httpd] .htaccess rule match keyword

Posted by Yann Ylavic <yl...@gmail.com>.
Hi,

On Mon, Feb 6, 2017 at 11:34 AM, Rajib Karmakar
<cr...@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