Log in

View Full Version : .htaccess troubles



mada9369
12-26-2008, 02:33 AM
how would i go about changing my urls that look like this;

http://localhost/profile/index.php?user=adam

to something like this;

http://localhost/profile/adam

Any help would be appreciated. =]

maneetpuri
12-26-2008, 09:49 AM
Hi,

Put this code in your .htaccess file and it should solve the purpose: -

RewriteCond %{HTTP_HOST} ^localhost/profile/index.php?users=$ [NC]

RewriteRule ^(.*)$ http://localhost/profile/$1 [R=301,L]

Hope this works for you!


Cheers,

~Maneet Puri

Master_script_maker
12-26-2008, 02:59 PM
try:
RewriteEngine on
RewriteRule ^profile/([a-z]+)$ profile/index.php?user=$1 [L]

mada9369
12-27-2008, 02:27 AM
Both of those codes showed no response ='/
But im using my localhost as a tester...
would that make a difference?

techietim
12-27-2008, 02:57 AM
You'll get a big 'ol error if you don't have mod_rewrite installed.

Try placing a .htaccess file in /profile with the following contents:


RewriteEngine On
RewriteRule ^([a-z]+)$ index.php?user=$1
RewriteBase /profile/

mada9369
12-27-2008, 03:09 AM
You'll get a big 'ol error if you don't have mod_rewrite installed.

Try placing a .htaccess file in /profile with the following contents:


RewriteEngine On
RewriteRule ^([a-z]+)$ index.php?user=$1
RewriteBase /profile/


that didn't work either :(
and how do check to see if i have mod_rewrite installed?

mada9369
01-28-2009, 10:08 PM
could it be the .htaccess file that is causing this?