Forum Moderators: phranque
i need help with htaccess/modrewrite, i've a forum i would want its only ssl (https) and all http redirect to https and [mydomain.tld...] redirct to [mydomain.tld....]
i have subdomains and subfolders normal the subdomains like "mysub.mydomain.tld" (subfolder: mysub)
RewriteCond %{SERVER_PORT} !=443
RewriteCond %{REQUEST_FILENAME} !/(_sub1¦_sub2)/
RewriteRule ^(.*)$ [mydomain.tld...] [R=301,L]
but the subdomains redirect to [mydomain.tld...]
anyone can help me?
but not work when i go to "sub1.example.com" it force me to [example.com...]
And i want thats all non-www force to www (exclude the subs, there is www not requerid)
example:
MainDomain (my Forum): [example.com...] to [example.com...]
Subdomains: [sub.example.com...]
and i forgot to say.. thats the subdomains non-ssl is.. [sub.example.com...] cuz my ssl cert is only for one domain.
ihave changed the pipe to solid, the first sub work (sub1.example.com) but the second sub not work, its redirect me to [example.com...]
/edit:
dont understand this and make me confuse.. the sub2 is a webmail subdomain, all other subs work but only this sub doesn work.
Thats the error
---
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@sub2.example.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
---
But when i rename the htaccess btw disable it, the subdomain work o.O
You can 'break down' the RewriteCond into multiple lines if it make things any clearer:
RewriteCond %{SERVER_PORT} !=443
RewriteCond %{HTTP_HOST} !^sub1\.example\.com
RewriteCond %{HTTP_HOST} !^sub2\.example\.com
RewriteCond %{HTTP_HOST} !^sub3\.example\.com
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
Jim