Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 26th April 2010, 21:27
Ben Ben is offline
Moderator
 
Join Date: Jul 2006
Posts: 1,029
Thanks: 7
Thanked 62 Times in 56 Posts
Default mod_rewrite global ssl redirect and local rewrite not working

Hi folks,

I've got the following problem:

In my apache config I have the followin lines to redirect all requests to the ssl port, which is working fine:

Quote:
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{SERVER_NAME} !^mein.host.eu$
RewriteRule ^.*$ https://my.host.com%{REQUEST_URI} [L,R]
Besides this I got a local .htaccess file in one folder with some rewrite stuff for one application:
Quote:
RewriteRule ^(.[a-z_0-9]*)\.([a-z_0-9]*)\.html$ ?tos=$1&s=$2 [QSA,NC,L]
RewriteRule ^(.[a-z_0-9]*)\.html$ ?tos=$1 [QSA,NC,L]
But anyhow these both do not work together. The content of the .htaccess stuff overrules the ssl rewrite thing so that it seems to get ignored. Adding these lines on top of the .htaccess does not help either.

Any ideas how to solve this?
Reply With Quote
Sponsored Links
  #2  
Old 27th April 2010, 16:00
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,747 Times in 2,578 Posts
Default

The problem is the L flag (see http://httpd.apache.org/docs/2.2/rew...ite_flags.html ): "The [L] flag causes mod_rewrite to stop processing the rule set. In most contexts, this means that if the rule matches, no further rules will be processed."
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 27th April 2010, 21:42
Ben Ben is offline
Moderator
 
Join Date: Jul 2006
Posts: 1,029
Thanks: 7
Thanked 62 Times in 56 Posts
 
Default

Hmm but if I reomove the L-Flag from the ssl redirect thing, and only place these two rewrite rules to the .htaccess file, also removing the L-Flags, the ssl redirect does not work at all.

Any other ideas?

EDIT: Ah got it working... if changing the order to at first rewrite and then redirect it works fine. I also prependen the inverted port rewrite cond, so i can place the L Flag again in the matching case.

Last edited by Ben; 27th April 2010 at 21:50.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with upgrade to 2.2.34 brianetilley Installation/Configuration 14 11th November 2009 18:22
Exim Gateway with mailwatch (Unable to receive emails) siul0_0 HOWTO-Related Questions 10 9th May 2009 00:00


All times are GMT +2. The time now is 19:35.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.