Sourav Saha
Sourav Saha

Reputation: 173

My webpage getting redirected to the hosting site when someone enters a partially wrong URL

I have hosted my site in 000webhost.com in the free tier.

When I'm pressing "xyz.com/abc" instead of "xyz.com/abc.php" it's getting redirected to 000webhost.com site.

Anyways to prevent it.

Thanks in advance.

Upvotes: 0

Views: 279

Answers (1)

Jazz B
Jazz B

Reputation: 13

Of course that would be redirected to the Error Page as there is no such file called "abc" ( You can create a file named only "abc", think of Linux systems).

Three ways to solve this:

1)Alongside abc.php, also create a directory named "abc" and keep the same abc.php page with index.php . This will load the same page( but at a different location).

WARNING: If you have used relative paths in your code,Beware! May cause address resolution problems.

2) You can try using redirection features, if that is available with the free tier. As far I know, that is available in the professional cPanel provided by standard hosting services. But for 000webhost, I cannot vouch that.

3)Create a sub-domain "abc" and keep all the necessary files there too. This may sound redundant but will overcome the Warning associated with the 1st point.

Upvotes: 1

Related Questions