#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2011
    Posts
    37
    Rep Power
    4

    404 Not Found for RewriteRule


    Hello,
    I want to get some basic RewriteRules setup for a htaccess file. They are going to be redirected to one single page, and the content generated depending on the get parameters.

    Eg localhost.test/index.php?page=test becomes localhost.test/test/ and localhost.test/index?page=another becomes localhost.test/another.

    My PHP script works when I use the long URL's but I get 404 Not Found when I type in the short URLs.

    My htaccess file, created in notepad and encoded in ANSI:
    Code:
    Options +FollowSymlinks -MultiViews
    RewriteEngine On
    
    RewriteRule ^test$ index.php?page=test [NC]
    Apache access log:
    Code:
    127.0.0.1 - - [13/Feb/2012:15:22:44 +0000] "GET /test/ HTTP/1.1" 404 203
    127.0.0.1 - - [13/Feb/2012:15:22:44 +0000] "GET /favicon.ico HTTP/1.1" 404 209

    Apache error log:
    Code:
    [Mon Feb 13 15:22:44 2012] [error] [client 127.0.0.1] File does not exist: E:/Documents/test_web/test
    [Mon Feb 13 15:22:44 2012] [error] [client 127.0.0.1] File does not exist: E:/Documents/test_web/favicon.ico
    Would appreciate any help for this.

    Cheers,
  2. #2
  3. mod_dev_shed
    Devshed Supreme Being (6500+ posts)

    Join Date
    Sep 2002
    Location
    Atlanta, GA
    Posts
    14,817
    Rep Power
    1100
    Does requesting index.php?page=test show you what you want? That's the first step.

    Did you request /test or /test/ ? Your regular expression doesn't match /test/, so that would result in a 404, whereas /test should match.
    # Jeremy

    Explain your problem instead of asking how to do what you decided was the solution.

IMN logo majestic logo threadwatch logo seochat tools logo