Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-12-2011, 04:51 PM   PM User | #1
Mido™
Regular Coder

 
Join Date: Aug 2009
Location: in .........
Posts: 254
Thanks: 181
Thanked 0 Times in 0 Posts
Mido™ is an unknown quantity at this point
Need help in one of .htaccess commands

I want the user to could see the url of his profile page of the site in this way "http://www.mysite/username"
rather than
"http://www.mysite/profile.php?id="

and for that I used this command in .htaccess :

RewriteEngine On
RewriteRule ^([^/]*)\.$ /profile.php?id=$1&n=$a [L]

but the problem with this is I have to add "." in the end of the username to be like this :
"http://www.mysite/username."
and I want it to be like this without the "." :
"http://www.mysite/username"

hope if any one can help
Mido™ is offline   Reply With Quote
Old 12-12-2011, 05:06 PM   PM User | #2
BluePanther
Senior Coder

 
Join Date: Jul 2011
Posts: 1,226
Thanks: 3
Thanked 171 Times in 171 Posts
BluePanther is on a distinguished road
Should have post this in the apache forum
BluePanther is offline   Reply With Quote
Old 12-12-2011, 06:20 PM   PM User | #3
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Moving from PHP to apache configurations.
Your rule specifies the .: RewriteRule ^([^/]*)\.$
Remove the \. if you want to go without it. If you want it optional, add \.? instead.
Fou-Lu is offline   Reply With Quote
Users who have thanked Fou-Lu for this post:
Mido™ (12-12-2011)
Old 12-12-2011, 06:27 PM   PM User | #4
Mido™
Regular Coder

 
Join Date: Aug 2009
Location: in .........
Posts: 254
Thanks: 181
Thanked 0 Times in 0 Posts
Mido™ is an unknown quantity at this point
Quote:
Originally Posted by Fou-Lu View Post
Moving from PHP to apache configurations.
Your rule specifies the .: RewriteRule ^([^/]*)\.$
Remove the \. if you want to go without it. If you want it optional, add \.? instead.
Thanks but it didn't work and gave me error "500 Internal Server Error"
Mido™ is offline   Reply With Quote
Old 12-12-2011, 07:14 PM   PM User | #5
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
I'm not sure if you can match [^/] by itself like this. Refine your pattern to a more specific ruleset and try again.
Fou-Lu is offline   Reply With Quote
Users who have thanked Fou-Lu for this post:
Mido™ (12-12-2011)
Old 12-12-2011, 09:04 PM   PM User | #6
Mido™
Regular Coder

 
Join Date: Aug 2009
Location: in .........
Posts: 254
Thanks: 181
Thanked 0 Times in 0 Posts
Mido™ is an unknown quantity at this point
I tried but it didn't work, hope if there is a solution for it.
Mido™ is offline   Reply With Quote
Old 12-12-2011, 09:05 PM   PM User | #7
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
So what is the match you are currently using?
Fou-Lu is offline   Reply With Quote
Old 12-13-2011, 10:00 PM   PM User | #8
Mido™
Regular Coder

 
Join Date: Aug 2009
Location: in .........
Posts: 254
Thanks: 181
Thanked 0 Times in 0 Posts
Mido™ is an unknown quantity at this point
Quote:
Originally Posted by Fou-Lu View Post
So what is the match you are currently using?
I don't know what's you mean exactly, but I use this ^([^/]*)\.$ to get it characters or numbers after / and with "." in the end.
Mido™ is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:56 AM.


Advertisement
Log in to turn off these ads.