LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-09-2008, 09:18 PM   #1
DukeLeto
Member
 
Registered: Jan 2003
Location: Antarctica
Distribution: *watches the penguins pass by*
Posts: 56

Rep: Reputation: 15
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
 
Old 11-10-2008, 09:39 AM   #2
teknik
Member
 
Registered: Jun 2006
Location: Winnipeg, Canada
Distribution: Slackware 12.1
Posts: 33

Rep: Reputation: 16
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=[^&]+
 
Old 11-10-2008, 02:28 PM   #3
DukeLeto
Member
 
Registered: Jan 2003
Location: Antarctica
Distribution: *watches the penguins pass by*
Posts: 56

Original Poster
Rep: Reputation: 15
That doesn't work either, for reasons unknown to me. It causes the entire site to break.

Michael
 
Old 11-12-2008, 11:26 AM   #4
teknik
Member
 
Registered: Jun 2006
Location: Winnipeg, Canada
Distribution: Slackware 12.1
Posts: 33

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


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Subdomains with Apache 2.2.3 - vhost or rewrite rule? Serapis Linux - Server 8 01-25-2008 04:28 AM
rewrite rule base url apache2 sinister1 Linux - Software 3 11-23-2007 10:17 AM
Apache rewrite rule help kinetik Linux - Software 1 11-05-2007 11:18 AM
apache url rewrite gallew Linux - Server 0 08-25-2006 03:54 AM
Help me make this rewrite rule in Apache ganninu Linux - General 8 01-07-2004 08:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration