SEO URL - infinite loop issue

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
werendle
Forum Newbie
Posts: 14
Joined: Tue Dec 07, 2010 5:10 am

SEO URL - infinite loop issue

Post by werendle »

[text]
Hi, I am trying to make my dynamic URL's search engine friendly, I have added the .htacces file with the following which I found on this site, Thank you for the help with that :D
[/text]

Code: Select all

RewriteEngine On
RewriteRule index/(.*)/(.*) index.php?$1=$2
[text]
which does work nicely with the following PHP code in my index.php
[/text]

Code: Select all

<ul class="menu">
	<a href="index/page/home">Home</a> &nbsp;&nbsp;&nbsp;&nbsp;<img src="images/present.png" height="38" width="35" alt="logo"/>&nbsp;&nbsp;&nbsp;&nbsp;
	<a href="index/page/hints">Hints & Tips</a> &nbsp;&nbsp;&nbsp;&nbsp;<img src="images/present.png"height="38" width="35" alt="logo"/>&nbsp;&nbsp;&nbsp;&nbsp;
	<a href="index/page/occasions">Occasions</a> &nbsp;&nbsp;&nbsp;&nbsp;<img src="images/present.png" height="38" width="35"alt="logo"/>&nbsp;&nbsp;&nbsp;&nbsp;
	<a href="index/page/blog">Blog</a>&nbsp;&nbsp;&nbsp;&nbsp;<img src="images/present.png" height="38" width="35"alt="logo"/>&nbsp;&nbsp;&nbsp;&nbsp;
	<a href="index/page/about">About</a> 

	
</ul>
<br>
<?php
	$page = $_GET['page'];
 		switch($page) 
			{
				case('home'):
					include ("home.php");
				break;
				case('about'):
					include ("about.php");
				break;
				case('occasions'):
					include ("occasions.php");
				break;
				case('blog'):
					include ("blog.php");
				break;
				case('hints'):
					include ("hints.php");
				break;
				 
			}
?>
[text]
My issue is the URL keeps growing, so after a few clicks on the menu items i end up with index/page/index/page/index/page/index/page/occasions. Additionally it seems to kill the formatting I have created in my style.css file.
Any help or suggestions would be much appreciated
[/text]
Last edited by werendle on Sun Dec 19, 2010 11:02 am, edited 1 time in total.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Re: SEO URL - infinite loop issue

Post by s.dot »

Try changing your links from "index/page/home" to "/index/page/home"

or adding an HTML base tag
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
werendle
Forum Newbie
Posts: 14
Joined: Tue Dec 07, 2010 5:10 am

Re: SEO URL - infinite loop issue

Post by werendle »

[text]Hi s.dot, awesome, thanks for such a quick reply, that has sorted the loop url issue[/text]
Post Reply