I want to be able to enter the following into the URL:
https://mydomain.com/fork or https://mydomain.com/fork/
And for both to goto a subfolder called
https://mydomain.com/prod/fork_contents/index.html
But still only display https://mydomain.com/fork (or https://mydomain.com/fork/, either way)
I would like index.html to act as the root so all the image urls, etc still work (they are relative to '/prod/fork_contents/')
Currently the .htaccess in the root is:
ErrorDocument 404 /live/site_documents/document404.html
ErrorDocument 403 /live/site_documents/accessDenied.html
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d [OR]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^fork$ /fork/index.html [L,QSA]
RewriteRule ^fork/$ /fork/index.html [L,QSA]
RewriteRule ^fork/(.*)$ /prod/forklift_contents/$1 [L,QSA]
- https://mydomain.com/fork/ Works fine!
- https://mydomain.com/fork Doesn't work. The index.html loads, but it can't find any of the files. Firebug's net panel reports the following 'https://mydomain.com/css/style.css not found'. So the second case (without the trailin开发者_如何学Gog /) doesn't seem to know to go into https://mydomain.com/fork/css/style.css.
Thoughts?
You can use the question mark for optional charters
RewriteRule ^fork\/? /prod/fork/$1 [L]
For a very good tutorial on rewriting check this website .htaccess tips and tricks..
精彩评论