PDA

View Full Version : Mod rewrite help



Decode
28-08-2008, 12:16 PM
How do i change-

/profile.php?username=username

to-

/profile/username


Thanks. :)

EDIT: I've tried the code below but I get error 500 :(

RewriteEngine on
RewriteRule ^/profile.php?username=(.*) /profile/$1 [PT]

Source
28-08-2008, 01:44 PM
RewriteEngine on
RewriteRule ^profile/([A-Za-z0-9-]+)/?$ profile.php?username=$1 [L]

You got it mixed up a little bit, that should work.

Swearwolf
28-08-2008, 01:48 PM
Rewrite Engine On
RewriteRule ^profile/([^\/]+)/?$ /profile.php?username=$1 [L]

i fink

Decode
28-08-2008, 01:52 PM
RewriteEngine on
RewriteRule ^profile/([A-Za-z0-9-]+)/?$ profile.php?username=$1 [L]

You got it mixed up a little bit, that should work.



Rewrite Engine On
RewriteRule ^profile/([^\/]+)/?$ /profile.php?username=$1 [L]

i fink



I've just tried both of them and they don't work. Maybe its a problem with my localhost :S

Anyway +rep for helping :)

Swearwolf
28-08-2008, 01:52 PM
Possibly, it doesn't work on my hosting :p

Decode
28-08-2008, 02:01 PM
Possibly, it doesn't work on my hosting :p
Turned out i had rewrite_module off, so its on now and working :)

kreechin
28-08-2008, 10:58 PM
anyone know how to get this working with apache2? :P
Tried to get it working for ages and have had no luck, every time i try, apache seems to stop responding 8-) :P

Decode
29-08-2008, 09:36 AM
anyone know how to get this working with apache2? :P
Tried to get it working for ages and have had no luck, every time i try, apache seems to stop responding 8-) :P
Im using apche2 but its sort of built into wamp, I think there must be a config file somewhere with all of the options in, but on wamp you can just change them through a menu.

Dentafrice
29-08-2008, 07:14 PM
httpd.conf should be inside the conf or apache directory. Just find it.

You should see an option for the rewrite module, turn it on, if the modules wasn't compiled with Apache, you may have to compile it again.

Want to hide these adverts? Register an account for free!