Mod rewrite problem..

New to mod_rewrite? This is a good place to start.

Mod rewrite problem..

Postby thunderlee09 » Tue Jun 16, 2009 5:58 pm

Hi, I'm new to mod rewrite and I have everything set up perfect. (Mod rewrite installed and what not)

Code: Select all
rewriteEngine on
Options +FollowSymlinks
rewriteCond %{REQUEST_FILENAME} !-d
rewriteRule ^([^/]+)/$ /users.php?profile_name=$1 [L]

^^
This is my .htaccess

I got it working (mysite.com/username/) for about 3 mins.. ? After 3 minutes it stopped working.. I don't understand how this happend as I didn't edit anything ?! This is frustrating me because I have looked everywhere for a answer and no one has it! How do I get this stupid thing to work!

Example.. (www.m3diaserver.com/users.php?profile_name=ThunderLee)
[That is the full address to a users channel]

I want it to be www.m3diaserver.com/ThunderLee/

Is the above .htaccess file correct?

Please help me I have been trying to figure this out for 5 hours now and I'm frustrated (as you may notice :( )
thunderlee09
 
Posts: 3
Joined: Tue Jun 16, 2009 5:49 pm

Postby richardk » Wed Jun 17, 2009 11:09 am

Did you fix it?

Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^/]+)/$ /users.php?profile_name=$1 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby thunderlee09 » Wed Jun 17, 2009 1:53 pm

Hey thanks for the reply, at the moment it sort of works, not sure if it will conk out again if this happens I'll try your code ;).
thunderlee09
 
Posts: 3
Joined: Tue Jun 16, 2009 5:49 pm

Postby thunderlee09 » Thu Jun 25, 2009 4:30 pm

Sorry for bumping this.. I can't get it to work again :(.. I used the code above but it seems it won't work, please help!
thunderlee09
 
Posts: 3
Joined: Tue Jun 16, 2009 5:49 pm

Postby richardk » Fri Jun 26, 2009 8:47 am

What error do you get? A 404 error?
Are you missing the trailing slash? (You would get a 404 error.)
Does the directory exist?

Try (it will allow for an optional trailing slash)
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^/]+)/?$ /users.php?profile_name=$1 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 111 guests

cron