Sub domain Redirect problem [closed]

When using a sub domain it redirects to my default page/domain. This only happens when using HTTPS.. for example

https://forums.example.net – takes me to mydomain.net …BUT http://forums.example.net – takes me to the forums

I’m using Apache2 & Ubunutu 18.04 using my own VPS.

((sites-enabled)) 000-default.conf RewriteEngine on RewriteCond %{SERVER_NAME} =bans.raiderzmc.net [OR] RewriteCond %{SERVER_NAME} =status.raiderzmc.net [OR] RewriteCond %{SERVER_NAME} =raiderzmc.net [OR] RewriteCond %{SERVER_NAME} =forums.raiderzmc.net RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

vim: syntax=apache ts=4 sw=4 sts=4 sr noet

DocumentRoot /var/www/html/raiderzmc.net/ ServerName raiderzmc.net

<Directory /var/www/html/raiderzmc.net/>     Options +Indexes +FollowSymLinks +MultiViews +Includes     AllowOverride FileInfo Options     Order allow,deny     allow from all </Directory> 

RewriteEngine on RewriteCond %{SERVER_NAME} =raiderzmc.net RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

DocumentRoot /var/www/html/bans.raiderzmc.net/ ServerName bans.raiderzmc.net

<Directory /var/www/html/bans.raiderzmc.net/>     Options +Indexes +FollowSymLinks +MultiViews +Includes     AllowOverride FileInfo Options     Order allow,deny     allow from all </Directory> 

RewriteEngine on RewriteCond %{SERVER_NAME} =raiderzmc.net [OR] RewriteCond %{SERVER_NAME} =bans.raiderzmc.net [OR] RewriteCond %{SERVER_NAME} =forums.raiderzmc.net RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

DocumentRoot /var/www/html/forums.raiderzmc.net/ ServerName forums.raiderzmc.net

<Directory /var/www/html/forums.raiderzmc.net/>     Options +Indexes +FollowSymLinks +MultiViews +Includes     AllowOverride FileInfo Options     Order allow,deny     allow from all </Directory> 

RewriteEngine on RewriteCond %{SERVER_NAME} =raiderzmc.net [OR] RewriteCond %{SERVER_NAME} =forums.raiderzmc.net RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

DocumentRoot /var/www/html/status.raiderzmc.net/ ServerName status.raiderzmc.net

<Directory /var/www/html/status.raiderzmc.net/>     Options +Indexes +FollowSymLinks +MultiViews +Includes     AllowOverride FileInfo Options     Order allow,deny     allow from all </Directory> 

SSL Config – 00-default-le-ssl

DocumentRoot /var/www/html/raiderzmc.net/ ServerName raiderzmc.net

<Directory /var/www/html/raiderzmc.net/>     Options +Indexes +FollowSymLinks +MultiViews +Includes     AllowOverride FileInfo Options     Order allow,deny     allow from all </Directory> 

Include /etc/letsencrypt/options-ssl-apache.conf ServerAlias forums.raiderzmc.net ServerAlias bans.raiderzmc.net ServerAlias status.raiderzmc.net SSLCertificateFile /etc/letsencrypt/live/bans.raiderzmc.net-0001/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/bans.raiderzmc.net-0001/privkey.pem DocumentRoot /var/www/html/forums.raiderzmc.net/ ServerName forums.raiderzmc.net

<Directory /var/www/html/forums.raiderzmc.net/>     Options +Indexes +FollowSymLinks +MultiViews +Includes     AllowOverride FileInfo Options     Order allow,deny     allow from all </Directory> 

DocumentRoot /var/www/html/bans.raiderzmc.net/ ServerName bans.raiderzmc.net

<Directory /var/www/html/bans.raiderzmc.net/>     Options +Indexes +FollowSymLinks +MultiViews +Includes     AllowOverride FileInfo Options     Order allow,deny     allow from all </Directory> 

DocumentRoot /var/www/html/status.raiderzmc.net/ ServerName status.raiderzmc.net

<Directory /var/www/html/status.raiderzmc.net/>     Options +Indexes +FollowSymLinks +MultiViews +Includes     AllowOverride FileInfo Options     Order allow,deny     allow from all </Directory> 

Apache, Redirect is not working for substring

Issue

In apache, how can I redirect to homepage in case if you will go to exact string, but everything behind this string should be displayed normally, no redirect.

Example.

http://example.com/STRING -> go to homepage http://example.com/STRING_PAGE -> go to http://example.com/STRING_PAGE 

I tried

Redirect 301 /STRING http://example.com/ 

But in this case page is redirected to homepage too, for example in case of http://example.com/STRING_PAGE.

Thanks.

Redirect to a subdirectory frontpage using without using a WP plugin- what files to edit, and how?


My situation

I have a multisite setup, where I use subdirectories for different languages. I use the main homepage for English and subdirectories for other languages, as follows:

mywesbite.com : English language frontpage

mywebsite.com/jp/ : Japanese language frontpage

What I want to do

I would like to redirect people who live in Japan to the Japanese language ffrontpage without using a WordPress plugin.

What I have tried

Using the geoplugin.com , as inspired by the 3rd answer of this stack I edited the theme header.php file by adding the following at the very beginning

$  a = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$  _SERVER['REMOTE_ADDR'])); $  countrycode= $  a['geoplugin_countryCode']; if ($  countrycode=='JP'){         header( 'Location: https://mywebsite.com/jp/' );         exit;     } 

The problem

However, I get the following error

The page isn’t redirecting properly

An error occurred during a connection to mywebsite.com.

This problem can sometimes be caused by disabling or refusing to accept cookies.

Note: the redirecting works fine with an external website, for example

$  a = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$  _SERVER['REMOTE_ADDR'])); $  countrycode= $  a['geoplugin_countryCode']; if ($  countrycode=='JP'){         header( 'Location: https://anotherwebsite.com' );         exit;     } 

Is there a way to fix this error?

I am also open to other solutions not using a WP plugin.

Changed URL for a page that was indexed by Googlebot. Will redirect 301 from the old URL to the new one. But what to do with my Sitemap?

I’m planning to change a url for one of my site’s page.

Example:

From: https://www.example.com/old-post-slug

To: https://www.example.com/new-post-slug

The fact is that Google has already indexed the old url: https://www.example.com/old-post-slug

And from these DOC’s, we see that to avoid lose page ranking we should respond with a 301 - Moved permanently from the old URL pointing to the new URL.

https://support.google.com/webmasters/answer/6033049?hl=en

enter image description here

QUESTION

I get that I should redirect (301) from the old URL to the new one. So when Google re-crawls, it will see that change. But what should be on my Sitemap? The old URL or the new one? Or both?

I tend to think that it would be best to keep only the new url on my Sitemap. But what if Google crawls the new URL before it sees the redirect from the old one? Wouldn’t the new page URL start off as a new page (from Google’s index perspective) with zero ranking points? How does Googlebot handles that? What is the recommended practice?

OAuth native app without localhost redirect

Section 4.1 of RFC 8252 describes the OAuth authorization flow for native apps using the browser (i.e., external user-agent). In this flow, the native app receives the authorization code in step 4 by setting the redirect URI to the loopback IP. This, of course, requires the native app to open a port on the loopback interface and subjects us to attacks where other apps could get the authorization code (unless we use something like PKCE).

Our system is a client-server model where the clients are various custom command line tools with no real user interface. In our deployments, we can’t always guarantee that we will be able to open a port on the loopback (and we’d like to avoid the added security concerns that PKCE addresses). We would like to tweak the flow for our use case but want to make sure we aren’t leaving the door open for security issues. Here is the flow we’d like to use:

  1. Command line tool initiates intent to perform OAuth flow to Application Server.
  2. Application Server generates a random in progress session token and a separate random OAuth flow state value
  3. Application Server stores both values in the database together
  4. Application Server returns both values to the Command line tool
  5. Command line tool launches the external user-agent (e.g., browser) and starts the authentication process against the Authorization Server using the OAuth state value provided by the Application Server
  6. User authenticates
  7. Authorization Server redirects to the Application Server along with the state value
  8. Application Server retrieves authorization code and stores it in the database along with the in progress session token and OAuth state value
  9. Command line tool submits the in progress session token to the application server
  10. Application server retrieves the authorization code from the database and treats it as if the command line tool provided it

Outside of the potential for DoS abuse on submitting lots of OAuth initiations and the potential for the command line tool to initiate step 9 before the application server has completed step 8, are there other security issues to be concerned with?