LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-10-2010, 10:23 PM   #1
sir-lancealot
Member
 
Registered: Aug 2007
Posts: 346

Rep: Reputation: 31
Apache mod-rewrite help / question


Evening all, having a problem and while dusting off the apache for dummies book, thought I would post this perhaps for a quicker response / fix.

This is what is in place right now to redirect for missing files;

RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{SCRIPT_FILENAME} !-f
RewriteCond %{HTTP_HOST} ^www.*
RewriteRule (iws|jsp|jws|cfm|cfml|cfc|cfr|cfswf|sfc|html)$http://{HTTP_HOST}/

The problem is we wish to advertise a link to a folder on our site;
www.domain.com/folder
When we use that link it redirects to;
www.domain.com
I can link to www.domain.com/folder/index.html and that works but when no index.html is there it's being rewritten and I am not sure why. When I commented the above out it did work fine, so I know it's that above, and from some old notes from an old employee, it seems they did that to catch missing files, but couldn't I just use a 404 error catch for that? Either way, can the above be updated as to not redirect on that folder, or an exception made, etc.

Thanks.
 
Old 02-11-2010, 02:49 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

I don't know if you want to keep these rules, as I don't find they do something useful. You can indeed use a 404 error document to achieve the same.
Anyway if you want to keep using them and want your /folder not to be rewritten, then add as last rule:
Code:
RewriteCond %{REQUEST_URI} !^/folder
Regards

Last edited by bathory; 02-11-2010 at 02:53 AM.
 
Old 02-11-2010, 09:35 AM   #3
sir-lancealot
Member
 
Registered: Aug 2007
Posts: 346

Original Poster
Rep: Reputation: 31
They have been there before me and yea I am going to look a little more and just using the basic 404, but your one liner worked perfect.

Tnx
 
  


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
[SOLVED] Apache MOD REWRITE yoachan Linux - Server 4 01-21-2010 01:15 AM
Apache Mod Rewrite Help vital_101 Linux - Server 4 12-02-2009 12:38 AM
Mod Rewrite - Apache FormalLogic Linux - Server 2 03-19-2008 01:30 AM
Warn: Apache Mod-Rewrite vulnerability Capt_Caveman Linux - Security 0 07-30-2006 08:09 PM
apache mod rewrite Robert0380 Linux - Software 5 07-31-2003 04:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:21 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