htaccess redirect problem

by 5 replies
7
I need to have one page on this site not be https. Everything is set to redirect in htaccess. I need to keep the redirects only there as cpanel redirects were causing url visibility issues. Below is the present redirect code. How would I make /thankyou-for-signing-up/ be non https (http) without creating a loop?
Code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]


#----- START DAP -----
RewriteCond %{REQUEST_FILENAME} -f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} (.*)/wp-content/uploads/(.*) 
RewriteCond %{REQUEST_FILENAME} !(.*)(\.php|\.css|\.js|\.jpg|\.gif|\.png|\.txt|\.ico|\.jpeg)$ 
RewriteRule (.*) /dap/client/website/dapclient.php?dapref=%{REQUEST_URI}&plug=wp&%{QUERY_STRING}  [L] 
#----- END DAP -----

</IfModule>
#programming #htaccess #problem #redirect
  • Hey mate,

    Add a condition to your rewrite to exclude the path you don't want it to happen on.. something like...

    RewriteCond %{REQUEST_URI} !^/my/special/path

    Cheers,
    Michael
    • [ 1 ] Thanks
    • [1] reply
    • Anyone have much experience with mixed (http and https) WordPress sites? I've been trying to get this solved over at Apache forums:
      http://www.webmasterworld.com/apache...htm#msg3005738

      and somehow we either end up with a redirect to index.php or a loop when clicking through to the page that is exempted from the redirect.
  • Hi rhinocl,

    The htaccess condition I posted will do the trick. But I must ask.. why are you trying to make things complicated for yourself?

    Why not just leave SSL on for everything - it's a lot more manageable.

    Cheers,
    Michael
    • [1] reply
    • That's how I had the site originally and the form I made selected the correct aWeber list, and subscribed to it and redirected the correct page on the site but aWeber must have changed something because now when you start out on an https page and submit to to them it doesn't redirect correctly. I tested the same form from an http site and it worked correctly.
  • Gotcha, can you PM me the page in question? I'll see what I can figure out.

    Cheers,
    Michael

Next Topics on Trending Feed

  • 7

    I need to have one page on this site not be https. Everything is set to redirect in htaccess. I need to keep the redirects only there as cpanel redirects were causing url visibility issues. Below is the present redirect code. How would I make /thankyou-for-signing-up/ be non https (http) without creating a loop? Code: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L] RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] #----- START DAP ----- RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} (.*)/wp-content/uploads/(.*) RewriteCond %{REQUEST_FILENAME} !(.*)(\.php|\.css|\.js|\.jpg|\.gif|\.png|\.txt|\.ico|\.jpeg)$ RewriteRule (.*) /dap/client/website/dapclient.php?dapref=%{REQUEST_URI}&plug=wp&%{QUERY_STRING} [L] #----- END DAP ----- </IfModule>