Re: Rewrite Rules, SSL, and .htaccess

From: Jeremy Miller (jm_at_gblx.net)
Date: 03/29/04

  • Next message: Frederic Medery: "Re: nis : how to avoid user1 becoming user2 using local root ?"
    Date: Mon, 29 Mar 2004 12:29:16 -0700
    To: davec <davec@webpipe.net>
    
    

    davec wrote the following on 03/28/04 18:31:
    >> RewriteEngine on
    >> RewriteBase /usr/local/website
    >> RewriteCond %{SERVER_PORT} !^443$
    >> RewriteRule ^(.*)?$ https://%{SERVER_NAME}/$1 [L,R]
    >
    >
    > This seems to work for all cases except when I enter
    > www.mydomain.com/dir without the final trailing slash, and then I get a
    > 404 error. I did a little more research and found a rule that seems to
    > work (inside the Directory tag) only for that special case:
    > RewriteRule ^$ https://%{SERVER_NAME}/dir/ [L,R]
    > The rule only works when it is by itself. I tried to combine them like
    > this:
    > RewriteRule ^$ https://%{SERVER_NAME}/dir/ [L,R]
    > RewriteRule ^(.*)?$ https://%{SERVER_NAME}/$1 [L,R]
    > Then I get the same 404 error as before when I leave out the trailing
    > slash. How can I get both of these rules to work together?
    > Thanks,
    > Dave

    ahh.. the "trailing slash" problem with Apache..

    <URL: http://www.onlamp.com/pub/a/apache/2004/02/19/apache_ckbk.html?page=2>

    a quote from the above article:
    "The "trailing slash" problem can be caused by one of two configuration
    problems: an incorrect or missing value of ServerName, or an Alias with
    a trailing slash that doesn't work without it."

    Try reading that and double-checking your configuration.

    -- 
    -jm
    GPG Key ID: 0x7A245D01
    

  • Next message: Frederic Medery: "Re: nis : how to avoid user1 becoming user2 using local root ?"

    Relevant Pages

    • Apache Rewrite Query
      ... I've moved a site from one location to another, and am using modRewrite ... RewriteEngine On ... If I visit it without the trailing slash ... it tries to redirect to ...
      (comp.infosystems.www.servers.unix)
    • Re: mod_rewrite help requested, please
      ... >>I'm pulling my hair out trying to write this out correctly but I can't ... >>RewriteEngine on ... > Options +FollowSymlinks ... the trailing slash in the urls would be optional ...
      (alt.php)