Hey Everyone,
We are still having an issue with our htaccess. We’ve chosen to rewrite this post because we are clarifying the issue by representing our structure within this post. Are there any advanced users that can help us with this? If you are looking for the old post that was never resolved, you can find it here.
We are having an issue with our htaccess file. Our goal is to get the pages in a subdirectory to be viewed in the URL as if it were up a level. It is a little more complicated than it sounds. To clarify, our Hosting provider is using something called a Server Alias which points multiple domains into a single hosting account htdocs where a .htaccess file which the user into the appropriate directory for that domain’s specific website content. Any kind of help would be greatly appreciated. Here is our Root Directory structure:
/htdocs/
-
.htaccess (htaccess_01)
-
Domain1/
- .htaccess (htaccess_02a)
- errorpage.html
- index.html
- page.html
-
subfolder/
- .htaccess (htaccess_03)
- errorpage.php
- index.php
- page.php
- webyep-system/
-
Domain2/
- .htaccess (htaccess_02b)
- erorpage.html
- index.html
- page.html
-
Domain3/
- .htaccess (htaccess_02c)
- erorpage.html
- index.html
- page.html
Below is the makeup of each htaccess.
RewriteEngine On
#Rewrite for Domain 1
RewriteCond %{HTTP_HOST} ^www.domain1.com$ [NC] #Rewrites www requests to folder
RewriteCond %{REQUEST_URI} !^Domain1/.*$
RewriteRule ^(.*)$ Domain1/$1 [L]
RewriteCond %{HTTP_HOST} ^domain1.com$ [NC] #Rewrites non-www requests to folder
RewriteCond %{REQUEST_URI} !^Domain1/.*$
RewriteRule ^(.*)$ Domain1/$1 [L]
#Rewrite for Domain 2
RewriteCond %{HTTP_HOST} ^www.domain2.com$ [NC] #Rewrites www requests to folder
RewriteCond %{REQUEST_URI} !^Domain2/.*$
RewriteRule ^(.*)$ Domain2/$1 [L]
RewriteCond %{HTTP_HOST} ^domain2.com$ [NC] #Rewrites non-www requests to folder
RewriteCond %{REQUEST_URI} !^Domain2/.*$
RewriteRule ^(.*)$ Domain2/$1 [L]]
#Rewrite for Domain 1
RewriteCond %{HTTP_HOST} ^www.domain3.com$ [NC] #Rewrites www requests to folder
RewriteCond %{REQUEST_URI} !^Domain3/.*$
RewriteRule ^(.*)$ Domain3/$1 [L]
RewriteCond %{HTTP_HOST} ^domain3.com$ [NC] #Rewrites non-www requests to folder
RewriteCond %{REQUEST_URI} !^Domain3/.*$
RewriteRule ^(.*)$ Domain3/$1 [L]
This htaccess looks at what domain the viewer is requesting and sends him to the appropriate directory.
htaccess_02a
ErrorDocument 403 /errorpage.html
ErrorDocument 404 /errorpage.html
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /([^/]+/)*index.html(?[^ ])? HTTP/
RewriteRule ^(([^/]+/)*)index.html$ http://www.domain1.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^(www.domain1.com)?$
RewriteRule ^(.*)$ http://www.domain1.com/$1 [R=301,L]
AddType video/mp4 .mp4
This htaccess allows this sub-directory to be used as a root and forces index.html to the domain name. Currently passive in nature meaning:
www.domain1.com/index.html
could also be viewed at
www.domain1.com/Domain1/index.html
This is currently not an issue because we are not using WebYep and Disqus on this level. But depending on if we come to a resolve with the main issue, this htaccess might mirror the solution.
htaccess_03
ErrorDocument 403 /Team-SDA/errorpage.php
ErrorDocument 404 /Team-SDA/errorpage.php
RewriteEngine on
# Rewrite subdomain up one level and remove extension.
RewriteCond %{THE_REQUEST} ^GET /([^. ]+.)+php(?[^ ]*)? HTTP
RewriteRule ^(.+).php$ http://www.domain1.com/subfolder/$1 [R=301,L]
# Should work but is saying to many redirects.
# RewriteCond %{THE_REQUEST} ^GET /([^. ]+.)+php(?[^ ]*)? HTTP
# RewriteRule ^(.+.php)$ http://www.domain1.com/subfolder/$1 [R=301,L]
This htaccess is what we are currently working on. Please see the “Example Link” at the bottom of this post. It shows the reason why we are addressing this issue. This htaccess is supposed to stop Disqus from creating two instances on the same page by forcing the subdirectory to be viewed up one level. So if a viewer goes to:
www.domain1.com/Domain1/subfolder/index.php
it will be forced to
www.domain1.com/Domain1/index
This way the viewer can only view the page using one URL string which means only 1 instance of Disqus can be created. The problem with our current htaccess is that it removes the extention (.php). The amendment you recommended should’ve worked but we get an error message on Safari that says there are too many redirects. I suspect it has something to do with the redirects already happening on the previous htaccess.
- Is there anything we can change in our htaccess to address this issue?
- Is there another way we should be going about this?
Example Page:
(sutherlanddesignagency.com/Team-SDA/Bernard/htaccess-issue)
Thanks,
Bernard
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options