View Single Post
Old 12-29-2009, 11:04 PM   #3 (permalink)
Parvus
The Wanderer
Newcomer 
 
Parvus's Avatar
 
Join Date: Aug 2008
Posts: 21
Thanks: 1
Parvus is on a distinguished road
Default

" www.domain.com/jay/admin/viewUsers it will call viewUsers.php "

The first question I would ask is, to what do you want to redirect exactly ?
www.domain.com/jay/admin/viewUsers -> www.domain.com/jay/admin/viewUsers.php
or would you like:
www.domain.com/jay/admin/viewUsers -> www.domain.com/viewUsers.php

Let's asume you mean case 1.
The easiest would be:
Code:
RewriteEngine On
^(http://www.domain.com/jay/admin/viewUsers)$ $1.php
But let's make it a bit cleaner than that =P
Code:
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
^(.+)/viewUsers$ $1/viewUsers.php
# or even better:
#^(.+)/(\w+)/?$ $1/$2.php
#/? means that /viewUsers/ will also be redirected (notice the / on the end)
There are loads of combinations possible, it all depends on what you exactly need.
If you only need to redirect 1 specific url the upper code will do just fine. Want to redirect more url's who have the same base ? Than the RegEx will help you =]
Parvus is offline  
Reply With Quote