Winston Kotzan wrote:
> Hello, I have the following lines in my .htaccess file:
>
> RewriteEngine On
> RewriteRule ^(.*)\.htm /cgi-bin/viewpage.cgi?page=$1 [L]
>
> The above rewrites all .htm file requests to a program that dynamically puts
> the pages together. The trouble is if someone addresses the index web page
> such as <a rel="nofollow" style='text-decoration: none;' href="http://www.wakproductions.com/" target="_blank">http://www.wakproductions.com/</a> without specifying a *.htm file.
> That request will not rewrite as "index.htm"... how can I also get the
> default file to be rerouted to "viewpage.cgi?page=index"?
RewriteRule ^$ /cgi-bin/viewpage.cgi?page=index [L]
That will change <a rel="nofollow" style='text-decoration: none;' href="http://www.wakproductions.com/" target="_blank">http://www.wakproductions.com/</a> to
<a rel="nofollow" style='text-decoration: none;' href="http://www.wakproductions.com/cgi-bin/viewpage.cgi?page=index" target="_blank">http://www.wakproductions.com/cgi-bin/viewpage.cgi?page=index</a>
Also, your above pattern will transpose .html as well as .htm - don't
know if that is what you want, but thought that you may want to know
about that functionality. To only do .htm requests:
RewriteRule ^(.*)\.htm$ /cgi-bin/viewpage.cgi?page=$1 [L]
^
|
----------------------+
--
Justin Koivisto - spam.DeleteThis@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.
>> Stay informed about: rewrite_mod troubles