Jump to content

URL not displaying correctly


chrisguk

Recommended Posts

Hi,

 

I think my problem is a mixture of MODREWRITE and PHP.

 

I have the following .htaccess located in the web root.

 

RewriteEngine On
RewriteRule ^about/(([^/]+/)*[^/.]+)$ /about/index.php?p=$1 [L]             
RewriteRule ^(([^/]+/)*[^/.]+)$ index.php?p=$1 [L]

 

The index.php example below is located in the folder "about".  Just for your info I also have an index at the web root too serving other files.

 

<?php 
$page = isset($_GET['p']) ? $_GET['p'] : '/about/about'; 

switch($page) { 
/*----------------------- PAGES -----------------------------------*/ 

case 'about/profiles': 
$title = 'My Title'; 
$keyword = 'A few keywords'; 
$description = 'A good description.'; 
break; 

default:
$title = 'My Title'; 
$keyword = 'A few keywords'; 
$description = 'A good description.'; 
break; 
}
include($_SERVER['DOCUMENT_ROOT']. '/include/header.php');  

include($_SERVER['DOCUMENT_ROOT']. 'about/'.$page.'.php');

include($_SERVER['DOCUMENT_ROOT']. "/include/footer.php");

?>

 

This is my problem: 

 

When I click on the link http://mysite.co.uk/about/ it throws the errors out below. 

 

When I click on the link http://mysite.co.uk/about/profiles/ it works fine and for the life of me I cant understand what I have done wrong.

 

Warning: include(/var/www/mysite/about//about/about.php) [function.include]: failed to open stream: No such file or directory in /var/www/mysite/about/index.php on line 22

Warning: include() [function.include]: Failed opening '/var/www/mysite/about//about/about.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/mysite/about/index.php on line 22

 

I am a kinda of newbie so any help/guidance will be gratefully received :)

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.