Forum Moderators: phranque

Message Too Old, No Replies

Redirecting all *.php files in root to sub-directory

in .htaccess this should be easy?

         

coachm

2:14 pm on Jul 28, 2009 (gmt 0)

10+ Year Member Top Contributors Of The Month



Not really good at this stuff and don't want to screw things up. I'd like to redirect all the *.php file requests (to root) to a subdirectory.

Can someone direct me to the code that would do this?

Thanks. I know it's basic.

jdMorgan

7:00 pm on Jul 28, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Schematically:

# If not already rewritten
RewriteCond %{REQUEST_URI} !^[i]<new-directory-path>[/i]/
# internally rewrite matching URL_paths to add new directory path
RewriteRule ^([i]<url-path-pattern>[/i])$ [i]<new-directory-path>[/i]/$1 [L]

Please see the resources cited in our Forum Charter [webmasterworld.com] to get started.

JIm