LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Apache rewrite rule help - dynamic url to static page (https://www.linuxquestions.org/questions/linux-software-2/apache-rewrite-rule-help-dynamic-url-to-static-page-682254/)

DukeLeto 11-09-2008 09:18 PM

Apache rewrite rule help - dynamic url to static page
 
I'm having an issue with a rewrite rule I'm trying to create in a .htaccess file:

Code:

RewriteEngine on
RewriteCond  %{QUERY_STRING} =t=1234
RewriteRule  ^showthread\.php$ /static.htm? [R=302,L]

Specifically, I'm trying to make requests for:

forum.example.com/showthread.php?t=1234

Redirect internally to static.htm

I'm trying to do this in order to stop any database queries from occuring for this one forum thread.

However, everytime I try to implement this, .htaccess breaks the forum completely.

Any help is greatly appreciated.

Thanks,
Michael

teknik 11-10-2008 09:39 AM

What about this:

Code:

RewriteEngine on
RewriteCond %{REQUEST_URI} /showthread.php$
RewriteCond %{QUERY_STRING} ^t=1234
RewriteRule ^showthread\.php$ /static.htm [R=302,L]

If you want it to work when t is any number, not just 1234, then:
RewriteCond %{QUERY_STRING} ^t=[^&]+

DukeLeto 11-10-2008 02:28 PM

That doesn't work either, for reasons unknown to me. It causes the entire site to break.

Michael

teknik 11-12-2008 11:26 AM

Do you have any other rules in there? Actually, do any rules work? Maybe you don't have mod_rewrite enabled...


All times are GMT -5. The time now is 01:49 AM.