Forum Moderators: phranque

Message Too Old, No Replies

Mod rewrite directory trouble

         

kkonline

2:26 pm on Sep 15, 2007 (gmt 0)

10+ Year Member



When i use the code it works fine if i store pages.php in /public_html (mysite.com/pages.php) on the server BUT i get Page Not Found 404 error when i place the pages.php in a directory like mysite.com/directory/pages.php.

What to do in order that mode rewrite works independent of the directory i place pages.php in?

I am using the following code in my .htaccess file

Options +FollowSymLinks

RewriteEngine On
RewriteRule ^pages/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)(/*)$ pages.php?sid=$1&catid=$2&page=$3&mode=$4&tcheck=$5

RewriteRule ^pages/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/(.*)$ pages.php?sid=$1&catid=$2&page=$3&mode=$4&tcheck=$5

jdMorgan

3:17 pm on Sep 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not sure where you intend to get the information needed to select the correct directory. Something like this, perhaps?

RewriteRule ^[b]([^/]+/)?[/b]pages/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)(/*)$ [b]/$1[/b]pages.php?sid=$2&catid=$3&page=$4&mode=$5&tcheck=$6

Jim