My problem is that both none HTTPS requests and requests with WWW redirects to main page, whitch is fine when the requested url is the root domain, but not if the request is an article, special page etc.
Example 1: http://mydomain.com/wiki/Articlename redirects to https://mydomain.com/wiki/Main_Page, but I want to redirect to https://mydomain.com/wiki/Articlename
Example 2: https://www.mydomain.com/wiki/Articlename redirects to https://mydomain.com/wiki/Main_Page, but I want to redirect to https://mydomain.com/wiki/Articlename
This is my settings in .htaccess:
<IfModule rewrite_module> RewriteEngine On Options +FollowSymlinks # Redirect Mydomain.com to Mydomain/wiki/Main_Page RewriteCond %{HTTP_HOST} mydomain\.com [NC] RewriteCond %{REQUEST_URI} ^/$ RewriteRule ^(.*)$ /wiki/$1 [PT,L] # Short url for wiki pages RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [PT,L] # Permanent redirect www url to non-www RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$ [NC] RewriteRule (.*) http://mydomain.com/$1 [L,R=301] # Permanent redirect HTTP to HTTPS RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://mydomain.com/$1 [R=301,L] </IfModule>
Any idea what I'm doing wrong?