magento showing 403 forbidden error for sub domain - .htaccess

I have a magento multi store hosting. There hosted around 6 websites. Now I need to create another store using my sub domain. I created website, store and store view in magento back end and edited htaccess file. suppose my sub domain is abc.domain.in, this is my htaccess code,
SetEnvIf Host www\.abc\.domain\.in MAGE_RUN_CODE=abc_domain_in
SetEnvIf Host www\.abc\.domain\.in MAGE_RUN_TYPE=website
SetEnvIf Host ^abc\.domain\.in MAGE_RUN_CODE=abc_domain_in
SetEnvIf Host ^abc\.domain\.in MAGE_RUN_TYPE=website
And I changed base url for secured and unsecured in system --> configuration. But if I go to my website it shows 403 forbidden. It says
Forbidden
You don't have permission to access / on this server. Additionally, a
500 Internal Server Error error was encountered while trying to use an
ErrorDocument to handle the request.
Why is it so?? Any body can help me?

Related

How to deny all access to a directory and redirect 403?

I have a folder on my webserver and want to deny all access to that folder and all the files in it. Additionally, the visitor must be redirected to a specific error page on the same server.
The secured folder path is:
https://www.mywebsite.com/some_folder/files
The error page is located here:
https://www.mywebsite.com/some_folder/error.php
I tried placing a .htaccess file in the 'files' folder. This does prevent visitors from accessing the folder and files, but the redirect does not take place. I suspect that the syntax of the relative path is not correct.
This is my .htaccess:
ErrorDocument 403 /../error.php
Order deny,allow
Deny from all
When hitting the secured folder URL, the browser gives me this error message: "A 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request."
Does someone have an example of what my .htacces should be?
You may try this in some_folder/.htaccess:
RewriteEngine On
RewriteEngine !^error\.php$ error.php [L,NC]
This will rewrite all requests that start with /some_folder/ to some_folder/error.php though browser won't see status code 403.
Inside error.php you may use this php code to return 403:
http_response_code(403);

403 permission error in YII

I have transferred my YII website from old domain to the new domain, I am changing in my host file to check the changes reflected.
My problem is that YII throwing 403 permission error if I am not using slash(/) after the URL but if I put slash (/) after the site name all working perfectly.
Working setting
ipaddress http://example.com/
Not working setting
ipaddress http://example.com
How i will able to remove that permission error without using slash(/) in hostfile setting. I have also tried it by using .htaccess file, it throw 500 internal server error, when using htaccess file

Custom 404 error redirect not working for https requests in htaccess file

I have a simple 404 redirect in a .htaccess file which works fine for Http requests:-
ErrorDocument 404 /apps/handle_error.php
The handle_error.php returns an appropriate PNG image depending on the URL path. However, when I replace the request with Https, it returns the default 404 error page and never does the redirect.
I know my SSL certificate is installed correctly as I get valid content returned for normal static pages. Is there something I am missing in my htaccess file regarding 404 error redirects for Https requests?
(A similar question was asked here but with no clear resolution)
After much soul searching I found the answer, for my specific case anyway.
My Apache2, mod_ssl and mod_rewrite was not configured correctly to work together. The default AllowOverride setting in my SSL config was set to "None" and mod_rewrite requires a minimum of AllowOverride of "FileInfo".
(To be fair, I got my answer from ServerFault)

Enable mod_rewrite rules for page not managed by Joomla - 403 forbidden

I have a simple issue to resolve. Every time I access one of the URLs explicitly defined in .htaccess (used by Joomla), I'm getting 403 Forbidden message.
Details about my setup:
I'm using shared hosting
Joomla is installed in the root folder
my newly created page is located in /new/products.php
.htaccess is the default one supplied by Joomla with one additional rule: rewriterule $/new/products^ /new/products.php [R=301,L]
Options +FollowSymLinks is commented out, but switching it on doesn't change anything
Each time I access mysite.com/new/products I' getting:
Forbidden
You don't have permission to access /new/products/ on this server.
Additionally, a 404 Not Found error was encountered while trying to
use an ErrorDocument to handle the request.
Any ideas?
In the end I simply removed old site, cleared all Jooml entries in .htaccess and did RewriteBase to point to my directory. The problem is no more.

Magento Domain Configuration

I am following an example in a Magento book which
calls for the following to be written inside the .htaccess file:
SetEnvIf Host www\.acmefurniture.com MAGE_RUN_CODE=furniture_en
SetEnvIf Host www\.acmefurniture.com MAGE_RUN_TYPE=store
SetEnvIf Host ^acmefurniture.com MAGE_RUN_CODE=furniture_en
SetEnvIf Host ^acmefurniture.com MAGE_RUN_TYPE =store
SetEnvIf Host www\.acmeelectronics.com MAGE_RUN_CODE=electronics_en
SetEnvIf Host www\.acmeelectronics.com MAGE_RUN_TYPE=store
SetEnvIf Host ^acmeelectronics.com MAGE_RUN_CODE=electronics_en
SetEnvIf Host ^acmeelectronics.com MAGE_RUN_TYPE =store
SetEnvIf Host www\.acmeoutdoor.com MAGE_RUN_CODE=outdoor_products
SetEnvIf Host www\.acmeoutdoor.com MAGE_RUN_TYPE=website
SetEnvIf Host ^acmeoutdoor.com MAGE_RUN_CODE=outdoor_products
SetEnvIf Host ^acmeoutdoor.com MAGE_RUN_TYPE=website
I would like to use such an example except that I am running an xampp
server on a Windows 7 machine behind a firewal and do not own several
domain names.
So what I would like to ask, what can I use in place of acmefurniture,
acmeelectronics, and acmeoutdoor on a localhost server (where I am only
beginning to test magento)?
Of course, once out on the web a similar example would require the web
store maintainers to purchase their own domains etc... but for now I
was just wondering what to do to see how the pages in the example
show up on localhost.
I have tried modifying my C:\Windows\System32\drivers\etc\hosts file
and adding the following lines:
and then writing the following inside my C:\xampp\htdocs\magento.htaccess file:
SetEnvIf Host en.furniture.localhost MAGE_RUN_CODE=furniture_en
SetEnvIf Host en.furniture.localhost MAGE_RUN_TYPE=store
SetEnvIf Host en.electronics.localhost MAGE_RUN_CODE=electronics_en
SetEnvIf Host en.electronics.localhost MAGE_RUN_TYPE=store
SetEnvIf Host products.localhost MAGE_RUN_CODE=outdoor_products
SetEnvIf Host products.localhost MAGE_RUN_TYPE=website
but with this change when I point my browser to
http://en.furniture.localhost/magento
or
http://products.localhost/magento
I still get the same result. I was supposed to get two different pages.
Anyone have any idea why I am getting the same page in both cases?
How can I configure my Windows 7 + XAMPP + Magento environment so as to
get different sites in both cases?
Thanks,
John Goche
You can use any domain on your localhost. Even google.com. Just specify it in you hosts file. See more info here http://helpdeskgeek.com/windows-7/windows-7-hosts-file/
When you type in any domain name into your browser's address bar it first looks into the local hosts file. If the record is found there browser will send a request to a specified server which in your case is 127.0.0.0.
You could modify your windows host file to trick windows in to thinking those domain names point to your local machine:
for example, you would add:
127.0.0.1 somedomain.com
127.0.0.1 anotherdomain.com
When you type those into your web browser windows will try and look at your local WAMP setup for the domains.
You would then change your .htaccess like so:
SetEnvIf Host somedomain.com MAGE_RUN_CODE=[store1]
SetEnvIf Host somedomain.com MAGE_RUN_TYPE=store
SetEnvIf Host anotherdomain.com MAGE_RUN_CODE=[store2]
SetEnvIf Host anotherdomain.com MAGE_RUN_TYPE=store
where you would replace [store1] and [store2] with the store code for each store view which you can get from the magento admin (store management).

Resources