21298 Posts in 5735 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1379 Views |
-
htaccess and sub directories

14 April 2009 at 1:09am
Hi everyone,
I'm hoping this is a easy question with an easy solution but I'm not sure.
The scenario,
I've had to create a special page outside the CMS which is a bunch of hand coded HTML. This page is now uploaded under a directory called /stuff
What I've done is created a redirection page inside the CMS which redirects /stuff to /stuff/index.php
That all works fine and links as it's supposed to.. but it does look a bit ugly, because all the other pages are just /page1 /page2 etc and then I have /stuff/index.php in the URL bar.
I'm wondering, if it's possible to modify the htaccess file so that if someone hits /stuff, it bypasses the rewrite from SS and just lands on the directory (which will bring up my index.php file).
Thanks in advance!
Sean
-
Re: htaccess and sub directories

14 April 2009 at 3:14am Last edited: 14 April 2009 3:15am
Hi Sean
This is quite simple actually.
....
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
# Add the following line to your .htaccess file
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]This directive tells the rewrite engine to not perform a rewrite if the requested file is a directory. This applies to all directories however! If you just like to perform a rewrite from yourdir to yourdir/index.php, then add the following to your .htaccess
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/yourdir
RewriteRule .* yourdir/yourdir.php [L,QSA,NC]RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
...
| 1379 Views | ||
|
Page:
1
|
Go to Top |


