DevHeads.net

E-commerce Rewrite Rule

Good morning Team,

Below 4 URL in my e-commerce, please guide me right rewriterule for it.

1. domain.com / Clothing[Department] / Mens[Main Catagory] / Shirts[Sub
Catagory] / T-Shirts [Sub Sub Catagory] / White Shirt [product_id=15]

2. domain.com / Mens[Main Catagory] / Shirts[Sub Catagory] / T-Shirts [Sub
Sub Catagory] / White Shirt [product_id=15]

3. domain.com / Clothing[Department] / Mens[Main Catagory] / Shirts[Sub
Catagory] / White Shirt [product_id=15]

4. domain.com / contact-us

Sincerely
Creative Web Logo Technologies
Website: <a href="http://www.creativeweblogo.com" title="http://www.creativeweblogo.com">http://www.creativeweblogo.com</a>
Mobile: +919874704940
Skype: creative.web.logo
© 2008-2018 Creative Web Logo Technologies.

Comments

Re: E-commerce Rewrite Rule

By Eric Covener at 02/13/2018 - 10:21

On Tue, Feb 13, 2018 at 8:57 AM, Rajib Karmakar
< ... at gmail dot com> wrote:
What's the question? What have you tried? Normally a question about
mod_rewrite would involve a "to" and "from" URL.

Re: E-commerce Rewrite Rule

By Rajib Karmakar at 02/13/2018 - 11:23

Hello,

Yes, I need 4 URL to mod_rewrite.

Sincerely
Creative Web Logo Technologies
Website: <a href="http://www.creativeweblogo.com" title="http://www.creativeweblogo.com">http://www.creativeweblogo.com</a>
Mobile: +919874704940
Skype: creative.web.logo
© 2008-2018 Creative Web Logo Technologies.

Re: E-commerce Rewrite Rule

By Rajib Karmakar at 02/14/2018 - 04:58

Hello,

I build is it right?

3. domain.com / Clothing[Department] / Mens[Main Catagory] / Shirts[Sub
Catagory] / White Shirt [product_id=15] => RewriteRule
^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$
php-page-name.php?dept=$4&maincat=$3&subcat=$2&product=$1 [L]

4. domain.com / contact-us => RewriteRule ^contact/?$ contact-us.php [L]

Sincerely
Creative Web Logo Technologies
Website: <a href="http://www.creativeweblogo.com" title="http://www.creativeweblogo.com">http://www.creativeweblogo.com</a>
Mobile: +919874704940
Skype: creative.web.logo
© 2008-2018 Creative Web Logo Technologies.

On Tue, Feb 13, 2018 at 8:53 PM, Rajib Karmakar < ... at gmail dot com>
wrote:

RE: E-commerce Rewrite Rule

By stefaan.dutry at 02/14/2018 - 05:38

The regex groups count from left to right,
Also the paths start with a /
So the rule should be something like:

RewriteRule ^/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ php-page-name.php?dept=$1&maincat=$2&subcat=$3&product=$4 [L]
Hello,

I build is it right?

3. domain.com / Clothing[Department] / Mens[Main Catagory] / Shirts[Sub Catagory] / White Shirt [product_id=15] => RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ php-page-name.php?dept=$4&maincat=$3&subcat=$2&product=$1 [L]

4. domain.com / contact-us => RewriteRule ^contact/?$ contact-us.php [L]

Sincerely
Creative Web Logo Technologies
Website: <a href="http://www.creativeweblogo.com" title="http://www.creativeweblogo.com">http://www.creativeweblogo.com</a>
Mobile: +919874704940 
Skype: creative.web.logo
© 2008-2018 Creative Web Logo Technologies.

On Tue, Feb 13, 2018 at 8:53 PM, Rajib Karmakar < ... at gmail dot com> wrote:
Hello,

Yes, I need  4 URL to mod_rewrite.

Sincerely
Creative Web Logo Technologies
Website: <a href="http://www.creativeweblogo.com" title="http://www.creativeweblogo.com">http://www.creativeweblogo.com</a>
Mobile: +919874704940 
Skype: creative.web.logo
© 2008-2018 Creative Web Logo Technologies.

On Tue, Feb 13, 2018 at 7:51 PM, Eric Covener < ... at gmail dot com> wrote:
On Tue, Feb 13, 2018 at 8:57 AM, Rajib Karmakar
< ... at gmail dot com> wrote:
What's the question? What have you tried?  Normally a question about
mod_rewrite would involve a "to" and "from" URL.

Re: E-commerce Rewrite Rule

By Frank Gingras at 02/14/2018 - 08:46

Be wary of such blanket answers. When used in the per directory context
(Directory block or .htaccess file), the leading slash is stripped before
the rewrite rule is evaluated.

Consider using the rewrite log to see what is happening.

Re: E-commerce Rewrite Rule

By Richard at 02/14/2018 - 15:50

You seem to be making the "urls" that the client gets unnecessarily
complex which results in rewrite rules that are wasteful and ripe for
errors. You might want to reconsider the urls that you are presenting
to the client, making them more precise so that the rewrite rules can
be cleaner, or in many cases unneeded.

Needing a rewrite for a basic "contact-us" seems to be a bit of
overkill (aka, perpetual employment coding).

Re: E-commerce Rewrite Rule

By Frank Gingras at 02/15/2018 - 01:12

To add to the last response, consider using FallbackResource too, or
multiviews if the paths can be translated directly to a file.

On Wed, Feb 14, 2018 at 2:50 PM, Richard <lists- ... at listmail dot innovate.net