![]() |
Mod Rewrite Question
Code:
RewriteEngine Onwhen a user goes to www.domain.com/jay/admin/viewUsers it will call viewUsers.php |
Give this a try,
RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule ^([^\.]+)$ $1.php [NC,L] The RewriteCond tells mod_rewrite to ensure that we're not appending the file extension to a directory. The RewriteRule looks for a string that does not already have a period in it, denoting the probability of a file extension. This can be easily modified to allow periods, but check for a three character extension, or to any variety of test situations you would prefer. |
" 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 OnCode:
RewriteEngine OnIf 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 =] |
I guess I assumed he was just hiding the extension. Didn't dawn on me to ask if it was just for the one file. :)
|
he 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 |
RewriteEngine On
RewriteBase /jay/admin RewriteRule ^viewUsers$ viewUsers.php [NC,L] You might find this useful too. |
| All times are GMT. The time now is 03:49 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0