Home>

I'm sorry to hear that i am unfamiliar with the questions at StackOverflow.
If there are any confusing parts in the question, we will correct them each time.

I tried various things myself, but I feel like I'm doing something wrong because of lack of knowledge.
Although it is a long sentence, the phenomenon and environment that are occurring are explained below. I would appreciate your teaching.

Environment

Redirect processing was performed in conjunction with the transfer of HP.

HP is both before and after the move
・ X server use
・ Use WordPress

For the redirect processing method, transfer settings were made from the server panel of the X server.

・ I do not want to display an error page when redirecting
・ I want to forcibly clear the cache of users visiting the site

The problem you ’re experiencing

The normal redirect process seems to work, but when I did an organic search from Google, I confirmed that it was n’t working.
When you click the URL of the pre-relocation website displayed in the search results, the URL is accessed without the/(slash), and the following error page is displayed.
For the sake of concealing your domain name,
URL before relocation https://before.com
URL after relocation https://after.com
Search results (picked pages) from Google search "https://before.com/sample page"
I will.
(Since it was a Japanese URL page that was picked up, the example will be a Japanese "sample page")

When you actually access, the URL will be rewritten with/(slash) missing, and the following page will be displayed.

This site cannot be accessed.
The server IP address on the https://after.com sample page was not found.
What you noticed, what you noticed

・ "https://after.com sample page" Copy and paste this URL to another location
https: // after--com-k8wuv9s3t9apw354/
In this way, the URL was changed from. (Dot) to-(hyphen).
In general, Japanese URLs are supposed to be rewritten to the ones enclosed in "%".

I felt that the title problem only occurred on pages that did not exist at the destination.
Before the move
https://before.com/sample page
Exists, but the site after the move
https://after.com/Sample page
Does not exist.

I thought it was because there was no slash, and I tried the following, but it was misplaced.

-Add/(slash) to the end of the redirect URL of .htaccess
→ There was no change.
The .htaccess code is as follows.
It is automatically generated by the X server transfer settings.
I added/(slash) by myself to the URL of the last line.

SetEnvIf Request_URI ". *" Ngx_Cache_NoCacheMode = off
SetEnvIf Request_URI ". *" Ngx_Cache_StaticMode
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^ index \ .php $-[L]
RewriteCond% {REQUEST_FILENAME}! -F
RewriteCond% {REQUEST_FILENAME}! -D
RewriteRule. /Index.php [L]
</IfModule>
# END WordPress
Redirect permanent/https://after.com/

-Edit function.php and add/(slash) at the end
→ I referred this article.
https://blog.webico.work/htaccess02

I thought that it would be more dangerous to touch this area without expertise, so I asked a question here.
Thanks for your cooperation.

Current status

It is not a fundamental solution, but for the time being, following the steps 1 to 3 below, the error page has been resolved.
Just another problem ...

1 Cancel the redirect setting from the transfer source to the transfer destination
2. Use WordPress maintenance plug-in "WP Maintenance Mode" to redirect
3 Any page accessed will be properly redirected to the destination TOP page and the error page "Cannot access this site" will not be displayed and resolved?

However, this situation is only possible when there is no browser history (cache?) in secret mode.
If the user has accessed the error page even once, the error page will be displayed again due to the power of the cache.
To put it the other way around, amateurs thought that if there was a way to forcibly clear the accessing user's cache, it would be resolved.
After examining it, it seems that editing of .htaccess is still necessary, and I pasted the following code on the source site (https://before.com), but nothing happened ;;

SetEnvIf Request_URI ". *" Ngx_Cache_NoCacheMode = off
SetEnvIf Request_URI ". *" Ngx_Cache_StaticMode
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^ index \ .php $-[L]
RewriteCond% {REQUEST_FILENAME}! -F
RewriteCond% {REQUEST_FILENAME}! -D
RewriteRule. /Index.php [L]
Header set Pragma no-cache
Header set Cache-Control no-cache
</IfModule>
# END WordPress
  • Answer # 1

    I can't reproduce it well, but it is only possible to change the URL by changing the domain name.

    And the old URL that appears in Google search is the correct URL.

    The .htaccess of the source domain
    Next to RewriteEngine On `

    RewriteRule ^ (. *) http://new.example.com/$1 [R = 301, L]
    What happens if I write something like

    ?