473,385 Members | 1,384 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Problem with RewriteCond and RewriteRule

Canabeez
126 100+
Hi Fellas,

I'm having a problem making a "Facebook" like nickname rewrites. Can anyone say what's wrong with this code:
Expand|Select|Wrap|Line Numbers
  1. RewriteEngine On
  2. RewriteCond %{REQUEST_FILENAME} !-f
  3. RewriteCond %{REQUEST_FILENAME} !-d
  4. RewriteRule ^/(.+)$ /user.php?name=$1 [L]
My problem is that apache2 is ignoring my RewriteCond and redirects the request to user.php even if the file exists (for example /index.php).

Thanks,
Simon
Apr 5 '10 #1

✓ answered by Canabeez

The problem was fixed:
Expand|Select|Wrap|Line Numbers
  1. RewriteCond /var/www/html/%{REQUEST_FILENAME} !-f
  2. RewriteCond /var/www/html/%{REQUEST_FILENAME} !-d
  3. RewriteRule ^/(.+)$ /user.php?name=$1 [L]
Simon

1 2501
Canabeez
126 100+
The problem was fixed:
Expand|Select|Wrap|Line Numbers
  1. RewriteCond /var/www/html/%{REQUEST_FILENAME} !-f
  2. RewriteCond /var/www/html/%{REQUEST_FILENAME} !-d
  3. RewriteRule ^/(.+)$ /user.php?name=$1 [L]
Simon
Apr 6 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Support | last post by:
Hello, I am running RedHat & Apache. RedHat does not allow creating more that 32000 subdirectories in one folder due to #defined constant limitation in the core code. I need to display 47000...
0
by: JZ | last post by:
I would like to exclude some files from Plone control within the same virtual host. The problem is, I cannot use mod_rerwite because Plone needs mod_proxy for working correctly. So the following...
13
by: alex | last post by:
Hi, I've got a php script located at : http://localhost/browse/script.php This script is "URL-rewrited" as http://localhost/welcome.htm This script includes other scripts with the following...
4
by: frizzle | last post by:
Hi group, I have the htaccess code that is below to redirect everything to index.php exept for the mentioned folders. (img, swf, js and css) Now when i try to access domain.com/testfolder/img...
12
by: frizzle | last post by:
Hi there, i have a site with fake folders & files. htaccess rewrites everything to index.php?vars now in index.php i decide what file to include with a switch/case statement. to define where...
2
by: David | last post by:
Sent this to alt.php a couple of days back, but doesn't look like I'll get an answer, so trying here. I'm trying to convert a script to use friendly URLs, I've done this before, but my PHP...
7
by: Jon Maz | last post by:
Hi, I'm having problems with a RewriteRule that's applied to url's with the % character in them, hope someone can help. The % character is a result of url-encoding non-ASCII words, as in the...
0
by: cssExp | last post by:
hello i seem to be having some problem. Consider the following. <Files index> ForceType application/x-httpd-php </Files> RewriteEngine On RewriteRule ^(+)/?$ index.php?ref=$1 RewriteRule...
0
by: AndyPSV | last post by:
Hello, I've got .htaccess file: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) index.php It works properly on mine and...
5
by: foekall | last post by:
dear all, I would like to ask about url rewriting in php. One of my project I got a problem with image path. .htacess I am using header.html as a common file. But the images from...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.