Home>

Hello, I may not understand a little.

The website is operated by a rental server.

At one time, I decided to use git, and to import the entire site with git clone.
However, since the www folder cannot be deleted, I decided to create a temp_www folder in www and import the site with git.
When I was told that I should copy the contents into www, it was so, but DB was also involved and it did not work.

This is the main subject.

I have been thinking here for a while.
http://example.com/
It ’s only natural when you visit
http://example.com/temp_www/
I felt it was necessary to redirect to.

Therefore, I tried to create the following .htaccess file, but it doesn't work.
Is there something strange about it?

I would appreciate it if you could tell me. Thank you in advance.
Is it possible to prevent temp_www from being displayed in the URL bar?

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond% {HTTPS} off
RewriteRule ^ (. *) $Https: //% {HTTP_HOST}% {REQUEST_URI} [R, L]
RewriteRule https://example.com (. *) $Https://example.com/temp_www$1 [L, R = 301]
</IfModule>
  • Answer # 1

      

    Is it possible to prevent temp_www from appearing in the URL bar?

    RewriteEngine On
    RewriteCond% {HTTPS} off
    RewriteRule ^ (. *) $Https: //% {HTTP_HOST}% {REQUEST_URI} [R = 301, L]
    RewriteRule ^ (. *) $Https: //% {HTTP_HOST}/temp_www/$1 [L]


    Or rewrite it a little more

    RewriteEngine On
    RewriteCond% {HTTPS} off
    RewriteRule ^ https: //% {HTTP_HOST}% {REQUEST_URI} [R = 301, L]
    RewriteRule ^/temp_www% {REQUEST_URI} [L]

  • Answer # 2

      

    RewriteRule https://example.com (. *) $https://example.com/temp_www$1 [L, R = 301]

    Replace

    with

    RewriteRule ^ (. *) $https://example.com/temp_www$1 [L, R = 301]

    Try it now.