views:

48

answers:

2
+1  Q: 

mod rewrite setup

I am trying to setup a mod rewrite rule to change urls like:

http://www.site.com/play/4435

Into:

http://www.site.com/index.php?play=4435

Below is what I have but it is not quite right...

RewriteEngine On
RewriteRule ^([^/\.]+)/?$ index.php?play=$1 [L]
A: 
RewriteEngine On
RewriteRule ^play/([^/]*)$ /index.php?play=$1 [L]

That should change http://www.site.com/play/4435 into http://www.site.com/index.php?play=4435

Hope that helps :)

Cal S
They probably don't want `play` hardcoded into the rules there.
random
Yea that does all kinds of weird things like. No images load. No flash loads...
ian
Cal S
I have my images as something like "images/image.png" so I will try putting in full URLs...
ian
A: 

Here's a more generic rule that works for more than just 'play'.

RewriteEngine On
RewriteRule ^(.+)/(.+)$ /index.php?$1=$2 [L]
Taylor Leese
That does the same thing. As the other answer. All my urls inside my page are getting changed to www.site.com/play/whatever
ian