Jump to content

Mod_rewrite Multiple directories


chrisguk

Recommended Posts

Hi,

 

Up until now I have been using the following .htaccess content:

 

Code:

 

RewriteEngine On
RewriteCond %{REQUEST_URI} !\/$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^robots\.txt$
RewriteRule ^([^/]+)/? index.php?p=$1 [L,QSA]

 

There has been no issue with the way it works until I want to do something more.

 

Example of my webpages:

 

index.php

home.php

contact.php

video.php

music.php

include/header.php

include/footer.php

 

My "index.php" pulls the pages in using switch:

 

PHP Code:
$page = isset($_GET['p']) ? $_GET['p'] : 'home';

switch($page) {

case etc etc........

include('include/header.php');

include(''.$page.'.php');

 

include('include/footer.php');

Now the problem I have is within the "video.php" file I have a link that goes to another file within a directory folder. The folder location is:

 

/video/newlist.php

 

But the problem I have is when I select the "video.php" link it takes me to the video folder and not the file called "video.php"

 

Is there anyway around this?

Link to comment
https://forums.phpfreaks.com/topic/259759-mod_rewrite-multiple-directories/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.