Jump to content
gary4u

How to let search engines first index and not the main.php page

Recommended Posts

Hi,

 

I have created a index.html page for a Disclaimer and then after click go to the main.php file.

Can I know how to let search engines first go to the index and not the main.php page.

eg: If you type www.mywebsite.com  - then it will go to the index file. But if you type in the search engine like-

www.mywebsite.com  contact    - it goes straight to the main.php. Which I do not want it to go.

Can any help me regarding this.

 

Thanks

 

 

Share this post


Link to post
Share on other sites

Actually the problem is that your site lets users go directly to main.php. You need to make sure they go through index.html first.

You do that with a cookie and a redirect. Have index.html set a cookie. If main.php (or any other page) sees that the cookie is not set, it redirects to index.html.

Share this post


Link to post
Share on other sites

Hi,

 

Thank you for your response. Do you have any code for this. It will be very helpful for me.

Share this post


Link to post
Share on other sites

It varies a bit. What is the index.html supposed to do? Why do users need to see it first?

Share this post


Link to post
Share on other sites

it just simple. When ever a user open the website it first go to the index.html. As this a Disclaimer info then after click IAGREE then it goes to the main.php.

This is the site  - www.letsarbitrate.com

But when I noticed that when a user types in any search engines the website name --www.letsarbitrate.com  contact    or   www.letsarbitrate.com   gallery or anything for that mattter. it goes to the main.php. Which I need to restrict it to the index.html that is the Disclaimer page after they click the " I Agree " then it should go to the main.php.

Share this post


Link to post
Share on other sites

That sort of thing is really better suited as a banner or popup on the page - not something separate to redirect with. Plus having it on the page means you don't have to deal with redirecting to or from it.

Code it into the page so it looks like you want. Use PHP to render it onto the page if the cookie isn't set, then use Javascript to set the cookie and remove the message.

Share this post


Link to post
Share on other sites

I have tried all sort of ways to redirect but it is not working. Can you please  suggest me  where I  can get a code for this. 

Share this post


Link to post
Share on other sites

And I'm telling you, this redirect stuff is annoying so take the other approach that doesn't require redirecting.

Besides, if you already have some code in place then me giving you even more to throw at it won't help. What code do you have and what exactly do you mean by "it is not working"?

Share this post


Link to post
Share on other sites

Its just some stuff like

 

<script> function newLocation() { window.location="http://letsarbitrate.com/index.html"; } </script>

Share this post


Link to post
Share on other sites

Okay, so, theoretically that would work fine. If you call the function of course. But it would be better if you did it with a true redirect through PHP.

What's the rest of the code?

Share this post


Link to post
Share on other sites

Sorry for the later response.

<script type="text/javascript"> function loadNewDoc(){ window.location="http://www.letsarbitrate.com/index.htm"; } </script>

</head>

<body onLoad="setTimeout('loadNewDoc()', 5000)">

But there might  be a problem , whenever the page loads this script will run.

 

Share this post


Link to post
Share on other sites

Right. You need something smarter.

Whether you go with what I said or continue with this, you need to learn to use cookies. When the visitor sees the index.html page you must set a cookie indicating that they have seen it. Then on other pages you only redirect to it if the cookie isn't set.

But keep in mind what you're doing is bad for SEO. Either you present a popup or you don't let the visitor even see main.php at all and do the redirect from the server.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.