Sitemap doesn't work

It is probably your apache configuration.

You should make sure you have the apache server treating xml files like xml files.

The problem is it isn’t in .html but .xml, It looks like that Google is unable to pass security system of infinityfree. (It is actually supposed to be accessible by google?)

@CarlosSantos Can you use cloudflare for your website? because it disables the security system so google crawler should be able to access your site.

3 Likes

Google crawler can access infinityfree perfectly. I have made a sitemap successfully on infinityfree before.

However, yes it might be infinityfree returning an error page.

How do I change it?

2 Likes

Ok, I’ll try it.

Well, I’ve just turned it on. What is it and what it does on my site?

Try opening devtools and navigating to that webpage on your browser. In the network requests, it should have the ability to show the content type of your page. If it’s text/html, then it will be your configuration itself.

Otherwise, it truly is infinityfree returning an error page (or something else having to do with inaccessibility).

@CarlosSantos

these NS do not exist so delete them (test is here)

Also you did something nasty with redirection (301)
because your domain is redirected to www
and then to www.www.domain !

sitemap.xml I can’t retrieve and check it right now due to the problem above

1 Like

I removed those NS.

This is my .htaccess:

<files ~ “^.*.([Hh][Tt][Aa])”>
order allow,deny
deny from all
satisfy all

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

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]

Options -Indexes

Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase / RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.html [NC] RewriteRule ^ %1 [R,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.html -f RewriteRule ^(.*?)/?$ $1.html [L]

Is the problem in here?

IMPORTANT: Make sure that the line RewriteEngine On is not repeated twice. In case the line already exists, simply copy the rest of the code without it.

Is that Wordpress you have up or ??

I think you can simplify everything and open an account on cloudflare

useful to read (why www ?? - there is no point )

4 Likes

I don’t know what I do. Now my website is going to www.www!

This line seems wrong. What is it supposed to do?

That said, the line probably doesn’t do anything. Any time your specify RewriteEngine On, it wipes all the previous rewrite rules. So there are a few rewrite blocks which are never used.

Also, the whole .htaccess lines you pasted here seem mangled and would probably just result in a 500 error. Can you please share it again, and in proper code blocks this time so the forum doesn’t try to parse it?

3 Likes

I don’t know what my htaccess does, I just know that redirects to https://www, and I copied from someone.

Here is the file:

<files ~ “^.*.([Hh][Tt][Aa])”>
order allow,deny
deny from all
satisfy all

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

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]

Options -Indexes

Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase / RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.html [NC] RewriteRule ^ %1 [R,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.html -f RewriteRule ^(.*?)/?$ $1.html [L]

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www. [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]

If xml not well-formed, it is doesn’t matter at all.

I have checked, it is well-ormed.

Well, I can tell you it’s bad. There are four RewriteEngine On statements, a Files block that’s opened but not closed, two pieces of code which both do something with WWW redirection, two blocks which do file/URL based rewriting, the second one formatted without newlines between the statements.

To be honest, I’m shocked it produces a page at all. I would fully expect Apache to fall over and die if you feed it this code.

I’m quite sure that this mess is responsible for your redirect issues. So I would highly recommend you just delete this file and start over by finding and combining relevant .htaccess snippets to do what you need to do.

You’ll probably get a much more reliable end result than when you just use someone else’s config without a clue as to what it’s even supposed to do, let alone how it does this.

4 Likes

Because I don’t know how to do it, I copy it from other people.

What should I do? Like, where do I go? Idk

First, decide what your .htaccess could should do. Sites can work perfectly fine without any .htaccess rules, so if you aren’t sure why you need them, then you can probably just delete the file and be done with it.

After that, you can just use Google to search for examples to do what you need to do and then combine those. They are all just snippets of text which you can combine in a single fine. It’s all very straight forward.

If one example doesn’t work, just try another.

That way, you may not understand exactly what each line does, but at least you’ll know what the code should be doing. It helps to add comments to the file with a short description about what it’s supposed to do and maybe the link to where you got it.

If you do this and you’ll have an issue again with www redirects, at least you’ll know which rules are responsible for www redirects, and can maybe swap them out.

2 Likes

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.