Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can !
Moderator: General Moderators
kkonline
Forum Contributor
Posts: 251 Joined: Thu Aug 16, 2007 12:54 am
Post
by kkonline » Sat Sep 15, 2007 9:19 am
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
Code: Select all
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
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Sat Sep 15, 2007 11:13 am
you need to specify the path to pages.php if you move it outside the root..
kkonline
Forum Contributor
Posts: 251 Joined: Thu Aug 16, 2007 12:54 am
Post
by kkonline » Sat Sep 15, 2007 11:25 am
Jcart wrote: you need to specify the path to pages.php if you move it outside the root..
So that means if i have mysite.com/dir1/pages.php
Code: Select all
RewriteRule ^dir1/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)(/*)$ dir1/pages.php?sid=$1&catid=$2&page=$3&mode=$4&tcheck=$5
if i have mysite.com/dir3/pages.php
Code: Select all
RewriteRule ^dir3/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)(/*)$ dir3/pages.php?sid=$1&catid=$2&page=$3&mode=$4&tcheck=$5
Is there any automatic way of writing the same thing again and again with just change of dir1 or dir 2 etc?