N
N
noxmag2018-07-03 22:28:00
htaccess
noxmag, 2018-07-03 22:28:00

Intercept the request to https://site.ru/sitemap.xml and send it to https://site.ru/seo_cap_sys/sitemap-general.php. Is it real?

Good day!
Task 1. Intercept the request to https://site.ru/sitemap.xml and send it to https://site.ru/seo_cap_sys/sitemap-general.php
Task 2
More complex
Intercept requests to https://site.ru/ sitemap1.xml and redirect to https://site.ru/seo_cap_sys/sitemap.php?num=1
where sitemap1.xml is the number after the sitemap and before the dot should go to https://site.ru/seo_cap_sys/sitemap.php ?num=1 - num parameter

Answer the question

In order to leave comments, you need to log in

5 answer(s)
M
Maxim Fedorov, 2018-07-04
@noxmag

Second option

Task 2
More complex
Intercept requests to https://site.ru/sitemap1.xml and redirect to https://site.ru/seo_cap_sys/sitemap.php?num=1
where sitemap1.xml is the number after the sitemap and before the dot go to https://site.ru/seo_cap_sys/sitemap.php?num=1 - num parameter

Checked - works for any digits (\d+)
sitemap1.xml leads to seo_cap_sys/sitemap.php?num=1
sitemap6666.xml leads to seo_cap_sys/sitemap.php?num=6666

D
Dmitry Dart, 2018-07-03
@gobananas

More or less like this:

if($_SERVER['REQUEST_URI'] === '/sitemap.xml'){
    require('sitemap-general.php');
}

if($_SERVER['REQUEST_URI'] === '/sitemap1.xml'){
    require('sitemap.php?num=1');
}

E
Exploding, 2018-07-03
@Exploding

It is also possible in .htaccess:

RewriteRule ^sitemap.xml/?$ /sitemap-general.php [L]

N
Nikolai, 2018-07-04
@pragmatik

A few years ago, I did similar experiments with redirects. It's quite real. But both Ya.Webmaster and Google.Webmaster refused to process a link to https://site.ru/sitemap.xml with such a redirect, and, therefore, the idea turned out to be meaningless.

V
Viktor Taran, 2018-07-05
@shambler81

there is a third option, do not deal with crap,
but read on the Internet as the search engines themselves recommend.
1. Add the sitemap directive with its address to the robots.txt file
2. https://webmaster.yandex.ru/site/indexing/sitemap/
3. https://www.google.com/webmasters/tools/sitemap-li ...
sitemap-google.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question