Url rewriting does not work on https

Asked

Viewed 345 times

0

I have the following problem: Dude. htaccess defines my URL rewriting that works perfectly when accessed by http but when accessed by https it informs that the page has not been found. Below is my . htaccess.

AddDefaultCharset UTF-8

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^([^/\.]+)/?$ index.php?area=$1 [L]
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ index.php?area=$1&sub=$2 [L]
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ index.php?area=$1&sub=$2&subitem=$3 [L]

Has anyone ever been there? Do you have any idea what it might be?

  • I think it might help you: http://stackoverflow.com/questions/4398951/force-ssl-https-using-htaccess-and-mod-rewrite there’s an example of rewriting with https

  • That’s not quite what I’m looking for @Rafaelwithoeft . My rewrite has to work for both protocols, the problem is it’s only working for.

  • Fabio try to take a look at this then: http://www.askapache.com/htaccess/http-https-rewriterule-redirect.html in the part where it says New HTTPS to HTTP Redirection ^ It gives you the option to use the 2;

  • @Rafaelwithoeft thanks so much for the help, htaccess was correct, the error was in apache configuration.

  • Perfect, glad you found the solution.

1 answer

1

Solved, I’ll leave the answer here to help anyone else through it.

In apache the HTTP treatment configuration was with Allowoverride all and this releases the rewrite in the directory I need. However, the HTTPS was configured as Allowoverride None, thus preventing the url rewriting.

By switching to Allowoverride all the rewriting came to work perfectly.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.