Got a question? Ask a developer in our Developer's Corner Forum
| Useful htaccess Rewrite Examples |
|
Apache has a wonderful way to change URLs on your server before they are processed. To utilize this functionality, you first need to make sure mod_rewrite is enabled.
The next step is to modify your .htaccess file with the following to ensure that the RewriteEngine is turned on (this must come before any of the following code examples): RewriteEngine On
This example will redirect the user and ensure that they are at http://www.cmsmarket.com/ rather than http://cmsmarket.com/ # Redirect to www
This example will actually rewrite the URL so sitemap.xml goes to the XMap component: # Sitemap.xml redirect
A couple notes about the syntax used above:
Apache has wonderful reference documents out there to help explain these: http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html#RewriteCond http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html#RewriteRule
If you are looking for some more advanced examples, we like this page: http://corz.org/serv/tricks/htaccess2.php
|

