Hi all, I was having trouble getting to my development environment which I installed off of my root directory;
basically my structure looks like the following:
public_html
.htaccess
./catalog
./extras
./dev
../catalog
I was not able to get to /dev/catalog because of the .htaccess file located in the root directory. I was under the impression that you need to use .htaccess files to secure your site, but if I don't rename mine (the one located at the root) then I can't access my /dev directory.
How do I get around this issue? can I delete the .htaccess at the root level and still use it at the /catalog for my real store?
thank you all for the help - this one was a bugger to track down!
Charlene
Latest News: (loading..)
htaccess trouble on root
Started by cstovin, Jul 19 2012 06:55 PM
5 replies to this topic
#1
Posted 19 July 2012 - 06:55 PM
#2
Posted 19 July 2012 - 07:15 PM
.htaccess is local to the directory in which it is put.
Any rules related to public_html/dev/catalog/ need only be in the .htaccess of public_html/dev/catalog/.htaccess
As for the root .htaccess you only need rules in here if yourequire apply rules at that level.
e.g. on a live site the root .htaccess would pertain to www.mysite.com/
If you wanted http:/.mysite.com/ to 301 redirect to the domain including the www subdomain ( http://www.mysite.com/ ) you would place the rule in the root .htaccess.
Hope that makes sense.
Any rules related to public_html/dev/catalog/ need only be in the .htaccess of public_html/dev/catalog/.htaccess
As for the root .htaccess you only need rules in here if yourequire apply rules at that level.
e.g. on a live site the root .htaccess would pertain to www.mysite.com/
If you wanted http:/.mysite.com/ to 301 redirect to the domain including the www subdomain ( http://www.mysite.com/ ) you would place the rule in the root .htaccess.
Hope that makes sense.
Edited by FWR Media, 19 July 2012 - 07:17 PM.
Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls
KissMT Dynamic SEO Meta & Canonical Header Tags
KissER Error Handling and Debugging
KissIT Image Thumbnailer
Security Pro - Querystring protection against hackers ( a KISS contribution )
If you found my post useful please click the "Like This" button to the right.
Please only PM me for paid work.
KissMT Dynamic SEO Meta & Canonical Header Tags
KissER Error Handling and Debugging
KissIT Image Thumbnailer
Security Pro - Querystring protection against hackers ( a KISS contribution )
If you found my post useful please click the "Like This" button to the right.
Please only PM me for paid work.
#3
Posted 20 July 2012 - 01:04 AM
The root (/) .htaccess is processed first, and then any additional .htaccess file(s) down the line until you get to the directory your PHP script is in. Thus, the effects are cumulative. Note that even subdomains or add-on domains will follow this path.
If something is going on in /.htaccess that is messing up your /dev installation (such as SEO/SEF URL rewriting), you can
If something is going on in /.htaccess that is messing up your /dev installation (such as SEO/SEF URL rewriting), you can
- add /dev/.htaccess to back out those changes (which may or may not be practical), or
- move the osC-pertinent items from /.htaccess to a new /catalog/.htaccess. Anything that mentions "/catalog" may have to be modified. Or
- modify /.htaccess to not affect /dev (exclude it from rewrites)
#4
Posted 21 July 2012 - 10:23 PM
I didn't think about including my htsccess - here it is - thanks for the help!
C.
# DO NOT REMOVE THIS LINE AND THE LINES BELOW REDIRECTID:8SzVqi
RewriteEngine on
RewriteCond %{HTTP_HOST} ^vidagrace.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.vidagrace.com$
RewriteRule ^$ http://vidagrace.com/catalog [R=301,L]
# DO NOT REMOVE THIS LINE AND THE LINES ABOVE 8SzVqi:REDIRECTID
C.
# DO NOT REMOVE THIS LINE AND THE LINES BELOW REDIRECTID:8SzVqi
RewriteEngine on
RewriteCond %{HTTP_HOST} ^vidagrace.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.vidagrace.com$
RewriteRule ^$ http://vidagrace.com/catalog [R=301,L]
# DO NOT REMOVE THIS LINE AND THE LINES ABOVE 8SzVqi:REDIRECTID
#5
Posted 22 July 2012 - 02:58 AM
So this is your /.htaccess file? That's the full file, and it's the only .htaccess file? All it's doing is forcing an empty URI (/) to jump to your store /catalog. It does nothing to "secure" your site; it is only a convenience that you don't have to explicitly enter "/catalog" in the URL. I would have written it as:
Now, this should not be causing any problems with your /dev directory, because the URI will not be empty in the RewriteRule. How are you invoking your development system? If I go to www.vidagrace.com, it appears that you have currently disabled or renamed the /.htaccess. Ditto for www.vidagace.com/dev. www.vidagrace.com/catalog works, as does www.vidagrace.com/dev/catalog.
In your case, you want / only to go to /catalog, while /dev only goes to /dev/catalog, and everything else is left alone?
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/catalog [NC]
RewriteRule ^(.*)$ /catalog/$1 [L]
This assumes that vidagrace.com is the only domain being used (no subdomains, no add-on domains). Any URI that doesn't start with /catalog will have /catalog inserted. I don't think a 301 is necessary here, as long as the osC configuration itself uses /catalog in its links.Now, this should not be causing any problems with your /dev directory, because the URI will not be empty in the RewriteRule. How are you invoking your development system? If I go to www.vidagrace.com, it appears that you have currently disabled or renamed the /.htaccess. Ditto for www.vidagace.com/dev. www.vidagrace.com/catalog works, as does www.vidagrace.com/dev/catalog.
In your case, you want / only to go to /catalog, while /dev only goes to /dev/catalog, and everything else is left alone?
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/dev [NC]
RewriteCond %{REQUEST_URI} !^/dev/catalog [NC]
RewriteRule ^dev/(.*)$ /dev/catalog/$1 [L]
RewriteCond %{REQUEST_URI} !^/dev [NC]
RewriteCond %{REQUEST_URI} !^/catalog [NC]
RewriteRule ^(.*)$ /catalog/$1 [L]
That's one way of doing it. If your URI starts with /dev, but is not already /dev/catalog, insert /catalog after /dev. If your URI does not start with /dev or /catalog, insert /catalog at the beginning. So, the idea is that your live site, whether accessed through your site root or with an explicit 'catalog', should still go to /catalog/... Your development site can be accessed with either /dev or /dev/catalog.
#6
Posted 23 July 2012 - 05:19 PM
I didn't think that should be causing a problem either - I didn't add anything, as you know I am new at the OSC stuff, but one of the other members suggested commenting out or renaming the htaccess file on the root because in one of my other posts I couldn't get to my /dev; it kept giving me a 404 error? Once I commented the htaccess (renamed) it, then I was able to access the /dev/catalog....so I have no idea why it isn't allowing me access to my dev environment.....maybe that isn't the real trouble?
thank you ....will give this a whirl later today after work!
C.
thank you ....will give this a whirl later today after work!
C.









