Home / Web Hosting / How to redirect a web page without .htaccess

How to redirect a web page without .htaccess

PHP logo
Question: I have a shared hosting account, but my web host has disabled my ability to make .htaccess files. How can I create redirects on my site?

Answer: First of all, it is a bad practice for a web hosting provider to completely disable .htaccess. You should probably consider getting a new host, but if that is not an immediate option, you can use PHP to redirect.

First, replace all of the code in the file you want to redirect to this:

Change the address to reflect your real domain and the correct filename for your new page.

That’s it! There is no second step. You need to make sure that there is no text before the PHP code, not even the <html> tag. Now, every time users visit the old page, they will be automatically redirected to the new one.

Check Also

servers

Importance of web hosting to business

The world of business is very ruthless and unfair in some cases. It is a …

Powered by Namesco
© Copyright InternetBlog.Org.Uk 2024, All Rights Reserved