.htaccess tutorial

htaccess Elite


file extension and domain redirect

Ask your mod_rewrite and Redirection questions here, and get answers!

file extension and domain redirect

New postby wmghori » 28 Nov 2006 22:10

Hi,

Can you give me a sample code for .htaccess so it will treat every .php extension file as .php5 extention in the current directory and alll the sub directories?

One other thing

with the following code
_______
RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_HOST} mydomain.com
RewriteCond %{REQUEST_URI} !/mydomain
RewriteRule ^(.*)$ mydomain/$1 [L]
________

ok so i point my browser to mydomain.com its showing the following
http://mydomain.com/mydomain/index.php
instead of
http://mydomain.com/index.php

Can you tell me what i'm doing wrong in the above code.

Thanks & Regards
wmghori
 
Posts: 2
Joined: 28 Nov 2006 21:50

New postby produke » 29 Nov 2006 00:48

Add this to get .php files parsed as .php5 files
Code: Select all
AddType application/x-httpd-php .php .php5


Or use a rewriterule to make all files that end in .php be parsed as php5
Code: Select all
RewriteEngine On
RewriteBase /
RewriteRule (.*)\.php$ $1.php [L,T=application/x-httpd-php]


Or use the ForceType directive
Code: Select all
<FilesMatch "\.(php|php5)$">
ForceType application/x-httpd-php
</Filesmatch>




Notice that all of these examples use "application/x-httpd-php" as the php5 type, but it could be different depending on your web-host and php5 installation.. ie. might be "php5-cgi" if you are using a cgi'd version of php5
User avatar
produke
 
Posts: 242
Joined: 25 Sep 2006 04:48

New postby wmghori » 02 Dec 2006 10:27

Thanks alot man
wmghori
 
Posts: 2
Joined: 28 Nov 2006 21:50


Return to Redirect or Rewrite Questions