logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Coding & Scripting Corner View previous topic :: View next topic
Reply to topic   Topic: Why does my page not display?
Author
chrisguk



Joined: 27 Mar 2012
Posts: 2
Location: Germany

PostPosted: Tue 27 Mar '12 21:30    Post subject: Why does my page not display? Reply with quote

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

PostPosted: Thu 05 Apr '12 23:13    Post subject: Reply with quote

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: 7288
Location: Germany, Next to Hamburg

PostPosted: Fri 06 Apr '12 21:21    Post subject: Reply with quote

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: 7288
Location: Germany, Next to Hamburg

PostPosted: Sat 07 Apr '12 0:13    Post subject: Reply with quote

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

PostPosted: Tue 06 Aug '13 9:05    Post subject: Reply with quote

I think the issue is rewrite base().You do the mistakes in files. Mad
Back to top


Reply to topic   Topic: Why does my page not display? View previous topic :: View next topic
Post new topic   Forum Index -> Coding & Scripting Corner