rewriterule
Redirecting From One Domain To Another Using Mod Rewrite
Fri, 01/06/2012 - 17:44 | by philipnorton42Use the following rules in your Apache configuration (or your .htaccess file) to redirect all traffic from one domain to another. This also keeps the query string in place so that the user isn't just dumped to the homepage.
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com%{REQUEST_URI} [L,R=301]
These rules are mod_rewrite dependent, so you'll need that module enabled in your Apache install.
Using mod_rewrite And Zend Framework To Display Dynamic sitemap.xml
Fri, 04/03/2009 - 09:48 | by philipnorton42Whilst creating a site the other day I thought about how I would manage the sitemap.xml file. This file is basically a XML file containing a list of URLs. Most major search engines understand (and look for) this file, so having it present on a site is a definite must.
Redirect One Directory To Another With .htaccess
Mon, 05/19/2008 - 08:55 | by philipnorton42To stop access to a directory (and anything in that directory) all you need is a simple RewriteRule.
RewriteEngine on RewriteBase / RewriteRule ^exampledirectory/(.*)$ / [R=301,L]
In this example, if this .htaccess file resides in the root directory of the site and you try to access anything within /exampledirectory you will be redirected back to the root folder. To redirect to another folder (like anotherdirectory) on your web server use the following rule.
Using mod_rewrite On Form Parameters
Wed, 03/05/2008 - 12:42 | by philipnorton42Using mod_rewrite on websites is fairly straightforward and can create some lovely looking URL structures. Instead of having a URL that contains lots of odd looking parameters like this:
http://www.example.com/example.php?parameter1=value1¶meter2=value2
You can use a .htaccess file to rewrite the URL on the server side in order to shorten this to something like this: