Forum Moderators: phranque
---------------------------------------------------
What I'm trying to do......
---------------------------------------------------
[mydomain.com...]
REWRITES TO
[mydomain.com...]
BUT
[mydomain.com...]
STAYS AT
[mydomain.com...]
(NOT: [mydomain.com...]
----------------------------------------------------
This is the difficulty for me. I can get the first set to work, but not the second. With my rules I also have trouble getting the plain old [mydomain.com...] to load up properly. Are there any gurus out there that know what I'm doing wrong? Here is the code I have been trying to use:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/([a-z0-9]*)$
RewriteRule ^(.*) jump.php?section=$1
I have no idea what is the problem at this point and need a fresh perspective. Thanks!
-Ryan
Welcome to WebmasterWorld [webmasterworld.com]!
Your RewriteCond as written requires that the requested URI contain a slash followed by any number (including zero) of only the characters a to z lowercase or the digits 0 to 9. So, as long as there are no characters other than those in the URI, the redirect will occur. That's why you get a redirect on your index file when requested as "/" or blank.
I would suggest that you change your RewriteCond to something like:
RewriteCond %{REQUEST_URI} !^/?$
RewriteCond %{REQUEST_URI} !\.php$
You could also write that more compactly as
RewriteCond %{REQUEST_URI} !(^/?¦\.php)$
Apache mod_rewrite documentation [httpd.apache.org]
Apache URL Rewriting Guide [httpd.apache.org]
Regular-Expressions Tutorial [mnot.net]
Jim