yky123
-
Posts
2 -
Joined
-
Last visited
Posts posted by yky123
-
-
It seems any .htaccess rewrite will cause error 403 when accessing my webpage and no redirects, I try to redirect http to https and set up a Django-based website by modifying .htaccess.
for redirect http to https,I try something like this:
which is most of the answers from https://stackoverflow.com/questions/4083221/how-to-redirect-all-http-requests-to-https
RewriteEngine On RewriteCond %{HTTPS} !on ~or~ RewriteCond %{HTTPS} !=on ~or~ RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} ~or~ RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] ~or~ RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L] ~or~ RewriteCond %{HTTPS_HOST} !^www.example.com$ [NC] RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]
PS:www.example.com is replaced by my real url(with and without www)
for setup a Django-based website,i follow all steps in https://wiki.helionet.org/Django , which
modify .htaccess like this:
RewriteEngine On RewriteBase / RewriteRule ^(media/.*)$ - [L] RewriteRule ^(admin_media/.*)$ - [L] RewriteRule ^(hello/dispatch\.wsgi/.*)$ - [L] RewriteRule ^(.*)$ hello/hello/dispatch.wsgi/$1 [QSA,PT,L]
===================
parts of error log:
[Fri Mar 22 06:24:58.676083 2019] [rewrite:error] [pid 32763] [client IP:Port] AH00670: Options FollowSymLinks and SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also forbidden due to its similar ability to circumvent directory restrictions : /home/username/public_html/403.shtml
===================
the 403 page:
Forbidden
You don't have permission to access / on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
[Solved] Any .htaccess rewrite will causes error 403
in Customer Service
Posted
Yes, it works now. Thanks for your help.