SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Aug 2007
    Posts
    318
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Mod rewrite directory trouble

    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:
    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

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,692
    Mentioned
    20 Post(s)
    Tagged
    3 Thread(s)
    kh,

    You remove the start anchor (the ^ at the beginning of your regex).

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •