|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today! |
|
#1
|
|||||
|
|||||
|
Slight Problem with .htaccess
I have the following code in my .htaccess file for my website.
php Code:
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 |
|
#2
|
||||
|
||||
|
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 |
|
#3
|
|||
|
|||
|
Message Moved
Thread moved from 'PHP Coding' to 'Server Administration' by andrew.
Reason: |
|
#4
|
|||
|
|||
|
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 |
|
#5
|
|||||
|
|||||
|
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:
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 |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Server Administration > Slight Problem with .htaccess |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|