Hi,
I am trying to set up .htacess to help with base directory rewrites. The example is using subdirectories with a “/” in front and saying to set up the .htaccess for the new root directory.
I am currently developing on localhost (not a virtual server - and sorry and please I do not wish to install one at this time).
I am having trouble with the .htaccess commands listed in the Apache documentation:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain-name.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain-name.com$
RewriteCond %{REQUEST_URI} !folder/
RewriteRule (.*) /folder/$1 [L]
Right now, I am only developing locally - so no current domain name. I just want to be able to seamlessly transition to a domain, so thought to have all my redirects start from some test root folder. i.e. src=“/sub1”
Root in an HTML file under test file in Linux
i.e. /var/www/html/test/html
Index file
/var/www/html/test/html/index.php
Subdirectory examples:
i.e. /var/www/html/test/html/sub1 /var/www/html/test/html/sub2
Then to have my href / src as “/sub1”
- Is there a good way to set this up with .htaccess rewrite?
- Also, what do the lines above mean for the example of mod_rewrite and how to manipulate them for various examples.
- The book shows as an example:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase test/html/
</IfModule>
But, I do not see that example elsewhere.
Thanks!
Karen