Forum Moderators: phranque
<Files ~ "\.html$">
RewriteEngine on
RewriteRule ^/(.*)forum_([0-9]*)_([0-9]*).html /viewforum.php?f=$1&start=$2
RewriteRule ^/(.*)forum_([0-9]*).html /viewforum.php?f=$1
RewriteRule ^/(.*)topic_([0-9]*)_([0-9]*).html /viewtopic.php?t=$1&start=$2
RewriteRule ^/(.*)topic_([0-9]*).html /viewtopic.php?t=$1
RewriteRule ^/(.*)post_([0-9]*).html /viewtopic.php?p=$1
</Files>
thanks.
There is also the possibility that you'll need to add:
Options +FollowSymLinks
There's really no need to enclose the mod_rewrite code in a <Files> container, since the rules all specify that they apply only to requests ending with ".html".
Also, be aware that by using the regular-expressions quantifier "*", your patterns will accept *blank* fields in those positions. In general, the use of "+" would be more appropriate.
Jim
RewriteEngine on
RewriteRule ^(.+)forum_([0-9]+)_([0-9]*)\.html$ /viewforum.php?f=$1&start=$2 [L]
RewriteRule ^(.+)forum_([0-9]+)\.html$ /viewforum.php?f=$1 [L]
RewriteRule ^(.+)topic_([0-9]+)_([0-9]*)\.html$ /viewtopic.php?t=$1&start=$2 [L]
RewriteRule ^(.+)topic_([0-9]+)\.html$ /viewtopic.php?t=$1 [L]
RewriteRule ^(.+)post_([0-9]+)\.html$ /viewtopic.php?p=$1 [L]
#Options +FollowSymLinks
RewriteEngine on
RewriteRule ^test\.html$ http://www.example.com [R,L]
Then type yoursite.com/test.html into your browser -- if you are redirected to your home page, mod_rewrite is loaded -- if you are not redirected or receive a server error, uncomment (remove the # from) the first line of the code -- if you are still not redirected, or receive a server error, then mod_rewrite is not loaded.
Justin
RewriteEngine on
RewriteRule ^([^/]+)/forum_([0-9]+)\.html$ /$1/viewforum.php?f=$2 [L]
will rewrite [yoursite.com...] to [yoursite.com...]
With the .htaccess file in the /forums folder the rule becomes ...
RewriteRule ^forum_([0-9]+)\.html$ /forums/viewforum.php?f=$2 [L]
to do the same thing.
RewriteEngine on
RewriteRule ^([^/]+)/forum_([0-9]+)_([0-9]*)\.html$ /$1/viewforum.php?f=$2&start=$3 [L]
RewriteRule ^([^/]+)/forum_([0-9]+)\.html$ /$1/viewforum.php?f=$2 [L]
RewriteRule ^([^/]+)/topic_([0-9]+)_([0-9]*)\.html$ /$1/viewtopic.php?t=$2&start=$3 [L]
RewriteRule ^([^/]+)/topic_([0-9]+)\.html$ /$1/viewtopic.php?t=$2 [L]
RewriteRule ^([^/]+)/post_([0-9]+)\.html$ /$1/viewtopic.php?p=$2 [L]
I wanted the more "static" format for MSN, Yahoo who I believe are not as good as G for following dynamic links.
See the Library [webmasterworld.com] for a longer explaination.
Justin