SunQuest
           Server Administration
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesServer Administration

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old May 26th, 2005, 07:30 AM
influx influx is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 116 influx User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Slight Problem with .htaccess

I have the following code in my .htaccess file for my website.

php Code:
Original - php Code
  1.  
  2. RewriteEngine on
  3. RewriteBase /
  4. RewriteRule ^([A-Za-z_0-9-]+)$ user_home.php?user=$1


Now let me explain. I basically host a blog site for a few friends of mine and I make it possible for users to view their blog by visiting www.website.com/username instead of having to go to www.website.com/user_home.php?user=username.

The only problem with this is if somebody types in 'www.website.com/username/' instead of 'www.website.com/username' they will get a 404 error. How should I modify the .htaccess code to alleviate the problem with the extra slash at the end?

Thanks in advance!

-influx

Reply With Quote
  #2  
Old May 26th, 2005, 02:31 PM
honcho's Avatar
honcho honcho is offline
Contributing User
Codewalkers Beginner (1000 - 1499 posts)
 
Join Date: Apr 2007
Location: Cape Cod
Posts: 1,347 honcho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 52 m 2 sec
Reputation Power: 3
RE: Slight Problem with .htaccess

Add an optional slash to the end of the regex match expression:

Code:
RewriteRule ^([A-Za-z_0-9-]+)/?$ user_home.php?user=$1


Reply With Quote
  #3  
Old May 26th, 2005, 09:20 PM
System System is offline
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Posts: 665 System User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Message Moved

Thread moved from 'PHP Coding' to 'Server Administration' by andrew.

Reason:

Reply With Quote
  #4  
Old June 12th, 2005, 08:00 PM
influx influx is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 116 influx User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Slight Problem with .htaccess

This should work, I am aware, but now I have another question:

How come when I upload my .htaccess file to the root directory of my server, it disappears upon reconnecting to my ftp?

The redirections still work, but the change I wanted doesnt take place!

What is going on here?

Thanks in advance.
-influx

Reply With Quote
  #5  
Old June 12th, 2005, 08:17 PM
influx influx is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 116 influx User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Slight Problem with .htaccess

Alright, never mind that...my FTP client doesn't show .htaccess files, but when I log into PuTTY and list the directory with 'ls -al' it shows it.

So my .htaccess file is up, and it contains the following code:

php Code:
Original - php Code
  1.  
  2. RewriteEngine on
  3. RewriteBase /
  4. RewriteRule ^([A-Za-z_0-9-]+)/?$ user_home.php?user=$1


But, it still gives me a 404 error if I visit www.website.com/username/ but it works if I visit www.website.com/username

What could be wrong with the .htaccess?

Thanks in advance!
-influx

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesServer Administration > Slight Problem with .htaccess


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway