Jump to content


Photo

mod_rewrite


  • Please log in to reply
4 replies to this topic

#1 SharkBait

SharkBait
  • Members
  • PipPipPip
  • Advanced Member
  • 845 posts
  • LocationMetro Vancouver, BC

Posted 24 October 2006 - 03:51 PM

HI,

I can't remember what is it called and I know there have been lots of posts about it but can't for the life of me remember.

I want to take the URL myscript.php?action=product&id=2343 and change the url to read myscript.php/product/myProduct

I'd love to get into the debate on whether or not Google/MSN/Yahoo etc do better with their crawlers in this fashion as well but I'm sure that would have to be started in another section here at PHPFreaks ;)

Thanks!



#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 24 October 2006 - 05:29 PM

Something like this should do:
RewriteRule ^product/([0-9+)$ myscript?action=product&id=$2


#3 SharkBait

SharkBait
  • Members
  • PipPipPip
  • Advanced Member
  • 845 posts
  • LocationMetro Vancouver, BC

Posted 24 October 2006 - 07:15 PM

Now does this go into the httpd.conf

#4 SharkBait

SharkBait
  • Members
  • PipPipPip
  • Advanced Member
  • 845 posts
  • LocationMetro Vancouver, BC

Posted 28 October 2006 - 10:05 PM

Does this look right?

RewriteEngine On
RewriteRule ^entry/([0-9])$ entry.php?d=$1

It doesnt seem to be working.  The mod_rewite is loaded into apache.  What else can I check?

omg I'm dumb.. i figured out what I was doing wrong.

:-\

Though the issue I am having now is because the url looks like www.tingram.ca/blog/1 the images and things are not loading properly because they are set up like img src="images/blah.jpg"

is there something I can do to make this correct?

#5 SharkBait

SharkBait
  • Members
  • PipPipPip
  • Advanced Member
  • 845 posts
  • LocationMetro Vancouver, BC

Posted 28 October 2006 - 11:23 PM

This is how the page should look like: www.tingram.ca/entry.php?id=18

This is how it is showing up with the mod_rewrite www.tingram.ca/blog/18

Now it looks like somehow the mod_rewrite has stopped the CSS to load, but the mysql connection stuff and functions all work fine. I'm confused

** Fixed

I just added a / before the tags in HTML and it works nicely.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users