www.webdeveloper.com
Results 1 to 3 of 3

Thread: RewriteRule Failure

Hybrid View

  1. #1
    Join Date
    Aug 2007
    Location
    Washington
    Posts
    219

    RewriteRule Failure

    I have a PHP page called index_.php. It takes one parameter tpl, which is html file. So it takes something like index_.php?page.01.html. It then parses page.01.html and then displays it. Now I want to be able to use nice, simple urls like http://www.ee.com/issue2/page.01.html. I've tried to use an htaccess file but I seem to be having issues.

    The htaccess code I've been trying is something like this:

    Code:
    RewriteEngine on
    RewriteBase /issue2/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^.+$ index_.php?tpl=$1
    Unfortunately, it doesn't work. Any ideas on what I can do?

  2. #2
    Join Date
    Nov 2008
    Posts
    2,477
    I can't see anything wrong with your code - are you getting anything at all via $_GET on index_.php?

  3. #3
    Join Date
    Nov 2008
    Posts
    2,477
    Actually on second look, you're not capturing the subpattern so $1 is always empty. Try this:

    Code:
    RewriteEngine on
    RewriteBase /issue2/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule (.*) index_.php?tpl=$1

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles