I am new to url rewrite . I have a completed site with urls like abc.com/abc.php?id=54&title=abcd
. First of all i need friendly urls for SEO like abc.com/abc/54/abcd
. I know that can b accomplish by redirecting urls in .htaccess (But i have to change all my urls in code too). can i accomplish that without changing all my code url. Second how to not disturb the assets.
Need Help .
Thanks
3
Answers
You must change all your URLs in the code.. The other functionalities should not be affected as the
.htaccess
rewriting will point to the old URLs.You could find an workaround to redirect the user with javascript but this is not recommended for SEO. Something like:
JS (jQuery):
I know this will be a very controversial answer, but bear in mind… this is Googles answer to this question.
For so many people, they believe (because they’ve been taught) that dynamic URLs like
page.php?id=3&entry=65
are bad for SEO.However, that was before… and this is now.
In fact, with the progress that has been made by search engine crawlers such as “googlebot”, the opposite is true.
It is best to leave your dynamic URLs alone and not rewrite them (for SEO purposes).
This excerpt is from Google Webmaster Central…
You can read the full article here
I found this simply by searching the term “rewrite URL for dynamic pages”. (on yahoo… not Google)
And this article by Barry Schwartz.
Barry Schwartz is Search Engine Land’s News Editor and owns RustyBrick, a NY based web consulting firm. He also runs Search Engine Roundtable, a popular search blog on very advanced SEM topics.
You can use this rule in your
DOCUMENT_ROOT/.htaccess
file:This will let you use
abc.com/abc/54/abcd
in browser and it will internally route toabc.com/abc.php?id=54&title=abcd
.