.htaccess file and URL rewrite rule in php
Posted by Raj
.htaccess file and URL rewrite rule in php
Redirect URLs using .htaccess :
You can use .htaccess to redirect users to a different URL(redirect a url)
Sometimes you need to redirect some URL and/or page on your site to another one.
using the “Redirect” directive:
Redirect /folder http://www.example.com/newfolder
Another useful directive is the RedirectMatch
RedirectMatch "\.html$" http://www.example.com/index.php
This will redirect all requests to files that end with .html to the index.php file.
One of the more powerful tricks of the .htaccess hacker is the ability to rewrite URLs
simple rewriting
all requests to whatever.htm will be sent to whatever.php:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.htm$ $1.php [NC]
RewriteRule ^menu.html menu.php
This entry was posted on October 4, 2009 at 12:14 pm, and is filed under
.htaccess,
301 Redirect,
PHP,
PHP interview questions and answers,
rewrite rule,
URl
.You can leave a response, or trackback from your own site.