jackuess
12-05-2006, 04:25 AM
I'm trying to figure mod_rewrite out, and I find it a bit hard so far. I want all the scripts of my site to go trough my index.php script in the root.
This is my .htaccess:
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteBase /test
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_FILENAME} !(.*\.(css))$
RewriteRule ^(.+)$ index.php?page=$1 [L]
When, for example, going to test/articles the page parameter is set to 'index.php', which exists in articles, but I want it to be 'articles/index.php'. However if I comment out the first line, the page parameter is set to 'articles/', which is fine, but i need it to work with files, as well as directories.
I'm probably doing it wrong all together, but i would appreciate some directions.
This is my .htaccess:
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteBase /test
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_FILENAME} !(.*\.(css))$
RewriteRule ^(.+)$ index.php?page=$1 [L]
When, for example, going to test/articles the page parameter is set to 'index.php', which exists in articles, but I want it to be 'articles/index.php'. However if I comment out the first line, the page parameter is set to 'articles/', which is fine, but i need it to work with files, as well as directories.
I'm probably doing it wrong all together, but i would appreciate some directions.