Page 1 of 1
.htaccess w/ mod_rewrite Issues
Posted: Sun Dec 11, 2005 2:27 pm
by John Cartwright
Hey guys, heres my problem
Code: Select all
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^([A-Za-z]+).rtr$ index.php?page=$1
Very simple rule, I've been working with mod rewrite for some time but I am baffled. My current url is looking like
http://localhost/projects/runtings/artists.rtr
.htaccess is located in /runtings/
Of course changing artists to something else, anything else, even artists itself, results in a blank page. My index.php is not even loaded, so I do not know what do to from here.
Thank ye.
Posted: Sun Dec 11, 2005 11:17 pm
by John Cartwright
Seems I had to add the futh path to the index, as it was grabbing the index.php in my root directory, not the current directory
Code: Select all
RewriteRule ^([A-Za-z]+)$ http://localhost/projects/runtings/index.php?page=$1
Previously when using mod_rewrite I've never had to do this, so can anyone offer insight, and possibly a way to avoid having to write the futh path?
Posted: Mon Dec 12, 2005 12:12 am
by redmonkey
Probably due to the base directory being set as the document root of the webserver/virtual host
i.e...
.. means that any path specified will be from the ducoment root directory of the webserver/virtual host.
Your orginal rule would probably work fine with
Posted: Mon Dec 12, 2005 3:33 am
by John Cartwright
Thanks for the advice thus far. I'm now having problems with my links, for example: a link <a href="home">Home</a> would with the url being
http://localhost/projects/runtings/artists/ would conver the link into <a href="
http://localhost/projects/runtings/arti ... e">Home</a> instead of <a href="
http://localhost/projects/runtings/home">Home</a>
my htaccess looks like
Code: Select all
Options +FollowSymLinks
RewriteEngine On
RewriteBase /projects/runtings/
RewriteRule ^(article)/([0-9]+)$ index.php?page=$1&view=$2 [L]
Thanks :0
Posted: Mon Dec 12, 2005 3:52 am
by redmonkey
Which version of Apache are you running?
And where exactly is this .htaccess file within your directory structure?
This is a different .htaccess file from the original posted?