Portal Home > Knowledgebase > Articles Database > SEO Friendly URL (mod_rewrite) issue


SEO Friendly URL (mod_rewrite) issue




Posted by qcunlock, 07-15-2012, 12:49 PM
Hey Guys, I am trying to build friendly URL to my website/script I am trying to do the following my website is : mydomain.com script is @ mydomain.com/beta/ URL trying to change is :mydomain.com/beta/index.php?main_cat_id=8 To : mydomain.com/Store-Name/Product-Name This is my .htaccess Options -Multiviews RewriteEngine On RewriteBase / # Specify search friendly URLs RewriteRule ^Product-Name$ /beta/index.php?main_cat_id=8 [L] But that doesnt work , please let me know what i am doing wrong here. Thanks

Posted by gzoli, 07-15-2012, 01:47 PM
1. only works with apache RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} ^Product-name RewriteRule (.*) /beta/index.php?main_cat_id=8 [L] 2. your php decodes the url without any webserver dependencies $query=explode("/",$_SERVER[REQUEST_URI]); $main_cat_id=$query[1];

Posted by qcunlock, 07-15-2012, 02:52 PM
Hi, I am sorry, but i am really new to this , and I found the best way to SEO cheap is to learn I did the following and it gave Internal Server Error to all my pages including main Options -Multiviews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} ^Product-name RewriteRule (.*) /beta/index.php?main_cat_id=8 [L] $query=explode("/",$_SERVER[REQUEST_URI]); $main_cat_id=$query[1];

Posted by gzoli, 07-16-2012, 12:41 PM
This is not htaccess rule: $query=explode("/",$_SERVER[REQUEST_URI]); $main_cat_id=$query[1]; Try only this: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} ^Product-name RewriteRule (.*) /beta/index.php?main_cat_id=8 [L]

Posted by qcunlock, 07-16-2012, 12:45 PM
Hi, Tried that , and it doesnt effect anything.

Posted by razzbee, 07-23-2012, 09:11 PM
How to you expect that to work when you have to different domains.You can use RedirectMatch to fix this problem.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
Resell Reseller (Views: 587)
Hosts with Lpanel (Views: 520)


Language:

Customer Testimonials

John Doe
It's a great service with fantastic support. It's definately good value for your money. Overall rating, 10 out of 10.
Mike Smith
Much better than my previous hosting company - I also got help with migration at no extra cost. Friendly support too.
Copyright © 2015 DC International LLC in partnership with Bragin IT Solutions Inc. - All Rights Reserved.