16 Jan 2010

converting a website from windows to linux / asp to php

php 189 Comments

Module mod_rewrite URL Rewriting Engine

Most dynamic website pages built on windows platform will have a .asp or .aspx extension.

If your converting a site from windows platform to php and intend on hosting the new site on an apache server then you will probably want to honour the .asp or .aspx pages that have already been indexed within the search engines.

To do this you will need to use apaches rewrite engine.
This module provides a rule-based rewriting engine to rewrite requested URLs on the fly.
This means that when a website visitor requests a .asp page then you can rewrite the url and redirect them to the equivalent .php page.

To do this create a .htaccess file and place it in the root folder of your website OR the folder which contains the old .asp pages you wish to redirect.

This example shows redirection on the site www.bizante.com but you can change bizante.com to your own website.

RewriteEngine on
rewritecond %{http_host} ^bizante.com [nc]
rewriterule ^(.*)$ http://www.bizante.com/$1 [r=301,nc]
RedirectMatch 301 (.*)\.asp$ http://www.bizante.com$1.php

Here is a link to the official Module mod_rewrite page for Apache HTTP Server Version 1.3

http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html

Comments are closed.