I'm trying to create a mod rewrite for my main directory. I do not want to have a http://myurl.com/linksdir <-- directory.
Here is what I would think would work:
RewriteEngine on
RewriteBase /
RewriteRule ^/?$ /cgi-bin/page.cgi [L]
RewriteRule ^(.+) /cgi-bin/page.cgi?g=$1 [L]
But then I realized it could not get to any existing folder, a.k.a. the style sheet. Since I would want access to it, my images, and any new folder I create, I am lost.
After thinking and learning, I came to the conclusion that I am going to have to declare each folder separately. (Please correct me if there is a better way!) So I tried something like this:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !^.*/static/
RewriteCond %{REQUEST_URI} !^.*/images/
RewriteRule ^/?$ /cgi-bin/page.cgi [L]
RewriteRule ^([^/\.]+)?/?([^/\.]+)?/?([^/\.]+)?/?([^/\.]+)?/?$ /cgi-bin/page.cgi?g=$1 [L]
I copied the last line from a random website. It seems to work great, except it does not read html pages: i.e. a detailed new page. Also, I'm guess my folders can only be 4x deep. I don't want to have to expand the regular expression every time I want to create a folder deeper. I appologize in advance if this thread is redundant. Please help.
Thanks,
- Jonathan
Here is what I would think would work:
Code:
RewriteEngine on
RewriteBase /
RewriteRule ^/?$ /cgi-bin/page.cgi [L]
RewriteRule ^(.+) /cgi-bin/page.cgi?g=$1 [L]
But then I realized it could not get to any existing folder, a.k.a. the style sheet. Since I would want access to it, my images, and any new folder I create, I am lost.
After thinking and learning, I came to the conclusion that I am going to have to declare each folder separately. (Please correct me if there is a better way!) So I tried something like this:
Code:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !^.*/static/
RewriteCond %{REQUEST_URI} !^.*/images/
RewriteRule ^/?$ /cgi-bin/page.cgi [L]
RewriteRule ^([^/\.]+)?/?([^/\.]+)?/?([^/\.]+)?/?([^/\.]+)?/?$ /cgi-bin/page.cgi?g=$1 [L]
I copied the last line from a random website. It seems to work great, except it does not read html pages: i.e. a detailed new page. Also, I'm guess my folders can only be 4x deep. I don't want to have to expand the regular expression every time I want to create a folder deeper. I appologize in advance if this thread is redundant. Please help.
Thanks,
- Jonathan