.htaccess tutorial

htaccess Elite


Redirect /contact/ to /contact.php

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

Redirect /contact/ to /contact.php

Postby produke » 02 Oct 2006 02:16

There are a couple simple ways to do this that I use.


Redirecting http://www.askapache.com/contact/ to http://www.askapache.com/contact.php


Create a directory /contact/ and in the htaccess for that directory have this.
Code: Select all
DirectoryIndex http://www.askapache.com/contact.php


Better yet, move your contact.php script into the /contact/ directory, and rename it index.html, then use this htaccess code in the /contact/ directory.

Code: Select all
ForceType application/x-httpd-php



Or if you have your heart set on rewrites, you could put the contact.php in the cgi-bin directory and reference any calls for /contact/ to it. Remove /cgi-bin if you just want /contact.php.

I put all my php scripts in the cgi-bin directory.


Code: Select all
RewriteRule ^contact/$ /cgi-bin/contact.php [T=application/x-httpd-php]
User avatar
produke
 
Posts: 242
Joined: 25 Sep 2006 04:48

Return to Redirect or Rewrite Questions