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
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]
Link to comment
Share on other sites

[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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.