Web Hosting Talk







View Full Version : Mod_Rewrite


Carp
06-01-2006, 04:36 PM
How do I change site.com/1 to site.com/blah.php?blah=1


get my drift?


thanks!

ThatScriptGuy
06-01-2006, 04:57 PM
RewriteEngine on
RewriteRule ^/([0-9]+)$ /blah.php?blah=$1

Carp
06-01-2006, 05:05 PM
will that allow blah.com/2372372834 also?

ThatScriptGuy
06-01-2006, 05:07 PM
Don't see why not. That plus sign should allow the numbers to repeat, sooo...shouldn't have an issue.
Kevin

Carp
06-01-2006, 05:09 PM
Also how do I form this?

RewriteEngine on
RewriteRule /([0-9]+) /blah.php?blah=$1
RewriteEngine off

ThatScriptGuy
06-01-2006, 05:52 PM
Sorry....How do you form it?
Also, second line should be (I believe)
RewriteRule ^/([0-9]+)$ /blah.php?blah=$1

Kevin

Carp
06-04-2006, 09:58 PM
in /temp on my server, i have this:

RewriteEngine on
RewriteRule ^/([0-9]+)$ /blah.php?blah=$1




in .htaccess and i goto www.site.com/temp/23423 and its a 404???

ThatScriptGuy
06-04-2006, 10:00 PM
Put the .htaccess in root and change it to ^/temp/([0-9]+)$ /blah.php?blah=$1

Should be working.
Kevin