Jump to content

Mod Rewrite Concept Question


mcloan

Recommended Posts

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.
Link to comment
https://forums.phpfreaks.com/topic/25813-mod-rewrite-concept-question/
Share on other sites

If you use mod_rewrite GET will still work. Your sitll using the following url:
myscript.php?catid=2343

However 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 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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.