I apologize for another of those posts, but from what I will tell, my question differs from the current http -> https redirects available.

I wish to

      redirect all http://www.mydomain.com traffic to https://www.mydomain.com/wiki

AND

      redirect https://www.mydomain.com   to   https://www.mydomain.com/wiki

Spot the https during my first redirect goal.

For that first redirect, I can make this happen by putting:

RewriteEngine On
RewriteCond %{REQUEST_URI} /
RewriteRule ^(.*) https://%{SERVER_NAME}/wiki [R,L]

During my httpd.conf file and restarting.

I figured this could work for my https:// attempts. Notice, I'm not including

RewriteCond %{HTTPS} !=on

or anything like this. Yet, still https://www.mydomain.com transmits me to my index.html file during my server root.

Basically attempt to place the above Rewrite directives during my httpd-ssl.conf file and restart the server i quickly get infinite redirects.

What shall we be held doing wrong?

NOTE: For which its worth, /wiki is definitely an alias to /home/Customers/myusername/www/wiki (the complete road to wiki)

UPDATE

Rehash in regards to what I have attempted to date:

Attempt 1:

In httpd.conf:

RewriteEngine On
RewriteCond %{REQUEST_URI} /
RewriteRule ^(.*) https://%{SERVER_NAME}/wiki [R,L]

In httpd-ssl.conf:

Nothing Rewrite related

Result 1:

Redirects all http visitors to https://www.mydomain.com/wiki Does nothing for https://www.mydomain.com

Attempt 2:

In httpd.conf:

RewriteEngine On
RewriteCond %{REQUEST_URI} /
RewriteRule ^(.*) https://%{SERVER_NAME}/wiki [R,L]

In httpd-ssl.conf:

RewriteEngine On
RewriteCond %{REQUEST_URI} /
RewriteRule ^(.*) https://%{SERVER_NAME}/wiki [R,L]

Result 2:

Infinite redirects.

Attempt 3:

In httpd.conf:

RewriteEngine On
RewriteCond %{REQUEST_URI} /
RewriteRule !^wiki https://%{SERVER_NAME}/wiki [R,L]

In httpd-ssl.conf:

RewriteEngine On
RewriteCond %{REQUEST_URI} /
RewriteRule !^wiki https://%{SERVER_NAME}/wiki [R,L]

Result 3:

Infinite redirects.

Your rule will match every request (even /wiki). Attempt to exclude that:

RewriteRule !^wiki https://%{HTTP_HOST}/wiki [R,L]

The infinite redirects are from the proven fact that the rule matches both first client request (eg. http://...) and then any the following request.

You'd fare better to utilize a rewrite rule which excludes the wiki path in the match e.g.

RewriteRule !^wiki https://%{HTTP_HOST}/wiki [R,L]

or you will improve performance from the RewriteCond

RewriteCode %{REQUEST_URI} !^wiki

before your overall rule. This makes it simpler to include more complicated designs that you simply presently have inside your example (should you have to later inside your project).

I discovered an answer that is probably not probably the most robust however it works best for me.

During my httpd-ssl.conf file, underneath the VirtualHost container, I set the DocumentRoot to suggest towards the directory that I have been attempting to redirect to.

<VirtualHost _default_:443>
DocumentRoot "path on my HD where I wanted to redirect all along"
ServerName    All the usual stuff...
...

This takes proper care of "redirects" (not necessarily redirects any longer) for https transactions

For http (non-ssl) I put into httpd.conf:

RewriteEngine On
RewriteCond %{REQUEST_URI} /
RewriteRule ^(.*) https://%{SERVER_NAME}/wiki [R,L]

That appeared to get it done.