GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Need with XML htaccess rewrite (https://gfy.com/showthread.php?t=1352209)

lakerslive 02-13-2022 09:25 AM

Need with XML htaccess rewrite
 
Hi guys

so my sitemap is currently under domain.com/sitemap/

I need for it to be domain.com/sitemap.xml

How should htaccess look?

Currently it looks like
RewriteEngine On
RewriteRule ^sitemap.xml/?$ index.php


ty

just a punk 02-13-2022 10:09 AM

Code:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^sitemap.*$ https://domain.com/sitemap.xml [R=301,L]


lakerslive 02-15-2022 08:53 AM

Thank you. So now, i'm wondering if this is bad SEO redirect?????

So i had another dev do a redirect for me

before >
domain.com/sitemap/ was the url

after >
domain.com/sitemap.xml << developer made this link possible via htacess

PROBLEM #1
domain.com/sitemap/ << if you visit this page it still EXISTS

so developer made ANOTHER redirection via .htaccess
domain.com/sitemap/ to domain.com/sitemap.xml

PROBLEM #2
domain.com/sitemap/ KINDA exists... but HOW?

step1:
go to yahoo.com

step2
go to to domain.com/sitemap/ it will redirect you to domain.com/sitemap.xml BUT if you press "BACK" button on navigation
it will take you back to "sitemap.xml" when it should be YAHOO.com ?????? so, this bad redirect???????????????????????

zerovic 02-15-2022 03:57 PM

Personally, I love to have my redirects placed as clean as possible. If the sitemap is available on both URLs, you don't have to worry.

I had to read about sitemap files to make sure my sitemaps are good, but my conclusion is this.. you are on the same domain, you can have as many sitemaps as you want, search engines simply record the URLs you have and that's it.

Having two sitemaps, /sitemap/ and /sitemap.xml won't hurt you in any way in my opinion...

What concerns me the most, is migrating from HTTP to HTTPS.. Google says, you don't need to change anything anywhere, set a redirect and you are good to go, as Google will notice the change and simply follow your redirects, however, since I re-added one of my websites as HTTPS, my traffic doubled, and google considers my "old site", the same website, with HTTP, as a bad site for some reason. The site, with HTTP, has thousands of URLs excluded from the search results, while the newly added, even without a sitemap, with HTTPS, is loved by google.

Also, for some reason.. google will also ignore my robots.txt file here and there. Even if I have my redirect URLs set to /disallow/, there are many keywords ranking directly to sponsor through my URLs.

It's like, searching for "GFY" and you receive my URL, in the top fckn 5 results, which is like "domain.com/go/gfy", which leads you to gfy.com with my affiliate link lol

ps. I'm experimenting with lots of new ideas, and this somehow works. Not for long, for sure, but for now, google sends me free traffic on keywords I never even wanted to rank lol

just a punk 02-15-2022 04:33 PM

Quote:

Originally Posted by zerovic (Post 22965514)
Personally, I love to have my redirects placed as clean as possible. If the sitemap is available on both URLs, you don't have to worry.

Yep. The OP may also put this in his robots.txt:

Code:

Sitemap: https://domain.com/sitemap.xml
Sitemap: https://domain.com/sitemap/
User-agent:*
Disallow


zerovic 02-15-2022 04:47 PM

Quote:

Originally Posted by CyberSEO (Post 22965532)
Yep. The OP may also put this in his robots.txt:

Code:

Sitemap: https://domain.com/sitemap.xml
Sitemap: https://domain.com/sitemap/
User-agent:*
Disallow


And there's nothing to worry about in my opinion.

zijlstravideo 02-15-2022 05:55 PM

Quote:

Originally Posted by zerovic (Post 22965514)
Also, for some reason.. google will also ignore my robots.txt file here and there.

Yeah, seen this happen a few times as well. Even for pages for which it didn't make any sense to get indexed at all, like you've mentioned, outgoing redirect pages and such...

Adding a php header to these type of pages, fixed it for me:
header("X-Robots-Tag: noindex, nofollow", true);

FansCity 02-16-2022 03:56 AM

Sometimes I don't understand how it happens

zijlstravideo 02-16-2022 05:02 AM

Quote:

Originally Posted by lakerslive (Post 22965333)
PROBLEM #1
domain.com/sitemap/ << if you visit this page it still EXISTS

so developer made ANOTHER redirection via .htaccess
domain.com/sitemap/ to domain.com/sitemap.xml

PROBLEM #2
domain.com/sitemap/ KINDA exists... but HOW?

If the old url (/sitemap/index.php) is a real path, then yes, you would also still be able to access it directly at /sitemap or /sitemap/index.php.

To prevent this, add something like this at the top of the page at /sitemap/index.php:

if ($_SERVER[REQUEST_URI] === '/sitemap/index.php' || $_SERVER[REQUEST_URI] === '/sitemap/')
{
header("Location: http://$_SERVER[HTTP_HOST]/sitemap.xml",TRUE,301);
die();
}

It simply checks the current path. If the visited url contains "/sitemap/ " or "sitemap/index.php", force a redirect to yourdomain.com/sitemap.xml.


All times are GMT -7. The time now is 07:21 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc