mcloan Posted November 1, 2006 Share Posted November 1, 2006 I am learning php and I am trying to visualize how mod rewrite would affect a script if I am looking to have a site will totally friendly SEO urls. Let say I have this url myscript.php?catid=2343.If in places of my php script I uses $GET_['catid'], but then use mod rewrite via .htaccess later to rewite the urls will the $Get still work? Secondly if I use mod rewrite I realize the link in the browser address bar will be rewritten, but how do the links appear as I hoover over the a link what will be shown in the browser task bar at the bottom of the browser? The rewritten link or the link such as myscript.php?catid=2343. Lastly, is modrewrite the best way to build seo friendly Urls with php?Thank you. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted November 1, 2006 Share Posted November 1, 2006 If you use mod_rewrite GET will still work. Your sitll using the following url:myscript.php?catid=2343However you're just giving the above URL a mask. As you'll do something like this when mod_rewriting the above URL:[code]RewriteRule ^myscript/([0-9]+)$ myscript.php?catid=$1[/code]So fi you now go to mysite.com/myscript/5648 it'll be changed to this: myscript.php/catid=5648, however you wont see the latter URL as its sent in the background.So when you go to create your links you'll need to use the newer seo URL. Like so:[code]<a href="myscript/5689">See product 5689</a>[/code] Quote Link to comment Share on other sites More sharing options...
mcloan Posted November 1, 2006 Author Share Posted November 1, 2006 [quote author=wildteen88 link=topic=113471.msg461213#msg461213 date=1162402002]So when you go to create your links you'll need to use the newer seo URL. Like so:[code]<a href="myscript/5689">See product 5689</a>[/code][/quote]So if I understand correctly you really need to plan out how your mod rewrite urls will appear before you start coding to ensure your code is in the right format. Is this correct?Secondly is mod rewrite the only way to present clean seo friendly URLs?Thank you. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted November 1, 2006 Share Posted November 1, 2006 Yes that is correct you will have to plan your mod_rewrite urls. You cannot expect mod_rewrite to rewrite your links too.Yes mod_rewrite is the only way to create seo friendly URLs for dynamic content sites. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.