Make Dynamic URLs Search Engine Friendly - Check Your Server
(Page 2 of 7 )
In the introduction we referred to something called mod_rewrite. This is a module that is usually compiled into Apache web servers and is fairly complex to configure. But this is the concern of server administrators and need not worry us here. mod_rewrite makes use of a file called .htaccess to perform its rewrites and creating this file is all we will need to do. .htaccess tells the server how to convert between dynamic and static URLs. Writing this file usually requires some knowledge of regular expressions. Like many of us, you may wish that you had greater facility with regular expressions but have never quite gotten around to learning them properly. Well don’t worry - creating the .htaccess file will require absolutely no knowledge of regular expressions.
To ensure that your web host supports mod_rewrite you could send an e-mail to tech support or find out for yourself by creating the following text file:
<?php
phpinfo();
?>Save it as info.php, upload it to your server and invoke it by typing
http://www.mysite/info.php
into the address box of your browser.
The function phpinfo is very useful for determining how your server is configured, for looking at environment variables, cookies and the like but right now we are only concerned with mod_rewrite. Look for the heading "Apache" and then "Loaded Modules". You should find mod_rewrite amongst the many modules listed there. If so you are all set to begin and if not, speak to your web host.
Next: Create an .htaccess File >>
More Web Services Articles
More By Peter Lavin