Link to home
Start Free TrialLog in
Avatar of jbrashear72
jbrashear72

asked on

rewrite rule quick question

I am trying to write a rewrite rule to go into .htaccess

I want to show a url like this:
http://www.domain.com/article/

but article is really article.php

how does this re write rule need to be written.
Avatar of jbrashear72
jbrashear72

ASKER

I tried the attached code below.
it works when I go to:

/article.php
and works with
/article

and works with
/article?test=1

but I need it to work with
/article/test/1

I am using the  $PATH_INFO to break out the URL.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(([A-Za-z0-9\-]+/)*[A-Za-z0-9\-]+)?$ $1.php
 
 
 
**********************************************************
 
$var_array = explode("/",$PATH_INFO);
would give:
 
$var_array[0] = "article.php"
 
$var_array[1] = test
 
$var_array[2] = 1

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of caterham_www
caterham_www
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial