Author |
|
chrisguk
Joined: 27 Mar 2012 Posts: 2 Location: Germany
|
Posted: Tue 27 Mar '12 21:30 Post subject: Why does my page not display? |
|
|
I have 5 web pages at the root of my folder called for example:
index.php
about.php
contact.php
order.php
home.php
about/profiles.php
All of the pages are called by the index.php using GET method like so:
Code: | <?php
$page = isset($_GET['p']) ? $_GET['p'] : 'home';
switch($page) {
/*----------------------- PAGES -----------------------------------*/
case 'about':
$title = 'about';
$keyword = 'some keywords';
$description = 'some description';
break;
case 'contact':
$title = 'contact';
$keyword = 'some keywords';
$description = 'some description';
break;
case 'order':
$title = 'order';
$keyword = 'some keywords';
$description = 'some description';
break;
case 'about/profiles':
$title = 'order';
$keyword = 'some keywords';
$description = 'some description';
break;
default:
$title = 'home';
$keyword = 'some keywords';
$description = 'some description';
break;
}
include('include/header.php');
include(''.$page.'.php');
include('include/footer.php');
?> |
My links in the webpages look like this:
Code: | <a href="<? echo $url; ?>/about">About</a>
<a href="<? echo $url; ?>/about/profiles">Profiles</a>
<a href="<? echo $url; ?>/home">Home</a>
<a href="<? echo $url; ?>/contact">Contact</a>
<a href="<? echo $url; ?>/order">Order</a>
<a href="<? echo $url; ?>/about/profiles">Profiles</a> |
I have rewritten my URLs with MOD_rewrite in a .htaccess file which you can see below:
Code: | RewriteEngine On
Rewritebase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^robots\.txt$
RewriteRule ^([^/\.]+)/?$ index.php?page=$1 [L] |
Everything works fine when I navigate through contact, order and home. But when I select "about" it gives me the following message:
Index of /about
[ICO] Name Last modified Size Description
[DIR] Parent Directory -
[ ] profiles.php 26-Mar-2012 17:15 1.3K
Apache/2.2.20 (Ubuntu) Server at mysite Port 80
I have a few links on the about.php page also that point to /about/profiles |
|
Back to top |
|
Triple_Nothing
Joined: 01 Apr 2012 Posts: 39 Location: WI, USA
|
Posted: Thu 05 Apr '12 23:13 Post subject: |
|
|
Sorry for the late response.
Visually I see no resoning it reacts the way it does via provided info. If you still need help, possibly a text link to the files? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Fri 06 Apr '12 21:21 Post subject: |
|
|
I think the issue is the RewriteBase. Comment that out and have a trial. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Sat 07 Apr '12 0:13 Post subject: |
|
|
I've overseen this. Your rewrite rule is: if directory or files does not exist. In fact the about directory is there |
|
Back to top |
|
ionamartin123
Joined: 03 Jun 2013 Posts: 3 Location: US, Arkansas
|
Posted: Tue 06 Aug '13 9:05 Post subject: |
|
|
I think the issue is rewrite base().You do the mistakes in files. |
|
Back to top |
|