Forum Moderators: phranque
#Options +FollowSymLinks
RewriteEngine on
RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?mode=$1 [L] When www.example.com/hello is called, it should actually grab this instead:
www.example.com/index.php?mode=$1
I have been able to get the code to work when there is a folder above the root of the site (www.example.com/folder), but I can't seem to get it to work when it is at the root of the site (www.example.com).
Any ideas on this one?
Options +FollowSymLinks [b]-MultiViews[/b]
RewriteEngine on
#
RewriteCond %{REQUEST_URI} !^/index\.php$
RewriteRule ^(([^/]+/)*[^/]+)/?$ [b]/i[/b]ndex.php?mode=$1 [L]
RewriteRule ^(([a-z0-9-]+/)*[a-z0-9-]+)/?$ /index.php?mode=$1 [[b]NC[/b],L]
<link href="/templates/black/global.css" rel="stylesheet" type="text/css" />
<link href="/templates/black/main.css" rel="stylesheet" type="text/css" /> I think it is trying to rewrite EVERYTHING after the root of the site. Basically, when I open example.com/templates/black/main.css it rewrites it to index.php?something=/templates/black/main.css
Any suggestions here?
Thanks a lot for your help, I wish I knew a little more about .htaccess and mod_rewrite, heh :)
Yes, it would. Now what exactly do you want to rewrite, and what exactly do you not want to rewrite? Defining things both ways greatly reduces the possible coding combinations, and also prevent problems in interpretation that lead to unexpected results such as this.
It is defining the desired function, not coding it, that is the hard part... :)
Jim
These should be rewritten, however, I just want to start simple and rewrite the mode variable first.
index.php?mode=login should bring up the login page.
However, /images/image.gif should NOT be rewritten.
Everything worked fine when I tried to do a rewrite above the home directory, however I ran into problems when trying to do it below the home directory.
Options +FollowSymLinks -MultiViews
RewriteEngine on
#
RewriteCond %{REQUEST_URI} !^/index\.php$
RewriteRule ^([^/.]+)/?$ /index.php?mode=$1 [L]
Jim