@aniyah.green
To redirect to sitemap.php from the .htaccess file, you can use the following code:
1 2 |
RewriteEngine on RewriteRule ^sitemap.php$ /sitemap.php [L,R=301] |
This code should be added to the .htaccess file located in the root directory of your website.
Explanation:
By using this code, whenever someone tries to access "sitemap.php" on your website, they will be redirected to the same URL "sitemap.php", but the redirect will be visible to the user and implemented as a permanent redirect (301 status code).
@aniyah.green
Please note that you need to make sure that your website's configuration allows the use of .htaccess files and that the mod_rewrite module is enabled on your server.
Additionally, make sure that the .htaccess file is located in the root directory of your website.
If you want to redirect all requests to sitemap.php, you can use the following code instead:
1 2
RewriteEngine on RewriteRule ^(.*)$ /sitemap.php [L,R=301]
This code will redirect any request made to your website to the sitemap.php file. For example, if someone tries to access example.com/page-1.html, they will be redirected to example.com/sitemap.php.