Jump to content

Redirect after migration


Black Tiger

Recommended Posts

I converted my forums a couple of months ago and redirect is working great except for 1 page.

Google adsense is continuously looking for:

www.mydomain.org/forum/index.php?action=login which is from my old SMF forum. However the /forum directory does not exist anymore, so it will be redirected by IPS to:

https://www.mydomain.org/forum/index.php?action=login

This looks the same but generates a Page does not Exist errorcode: 1S160/2 from IPS.

In spite of the fact that there are absolutely no ads on a not found page, Adsense complaints about the "valuable inventory: no content" even after a rating this appears.

So I thought, maybe I can redirect this page to the login page of IPS, but I don't now how to do this. I tried:

RewriteEngine On
Redirect 301 /forum/index.php?action=login https://www.mydomain.org/index.php

but this does not work it keeps redirecting to the error page. So I'm probably doing something wrong in .htaccess.

Anybody a clue on how to do this correctly so Adsens stops bugging me about this?

 

Link to comment
Share on other sites

15 minutes ago, Black Tiger said:

Anybody?

Try this

# Rewrite --- https://www.mydomain.org/forum/index.php?action=login => https://www.mydomain.org/index.php

RewriteCond %{QUERY_STRING} (^|&)action=login($|&)
RewriteRule ^forum/index\.php$ /index.php?&%{QUERY_STRING}

 

Link to comment
Share on other sites

Unfortunately, it doesn't work. Maybe because other redirects?

This is what my .htaccess looks now:

	<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
	RewriteCond %{QUERY_STRING} (^|&)action=login($|&)
RewriteRule ^forum/index\.php$ /index.php?&%{QUERY_STRING}
	RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
	RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.(js|css|jpeg|jpg|gif|png|ico|map)(\?|$) /404error.php [L,NC]
	RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
	</IfModule>
	
Header set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
Header set X-Content-Type-Options "nosniff"
Header set Referrer-Policy: no-referrer-when-downgrade

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...