Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I need to change this so that one file in wp-admin is not forced through https:

# add a trailing slash to /wp-admin
RewriteCond %{REQUEST_URI} ^.*/wp-admin$
RewriteRule ^(.+)$ https://%{SERVER_NAME}/$1/ [R=301,L]

This forces all requests to /wp-admin through SSL but it is breaking a wordpress plugin which needs to access wp-admin/admin-ajax.php.

Is there a way to adjust the rule so that it will allow non encrypted requests to that one file?

thanks!

share|improve this question
add comment

2 Answers 2

Have not tested it, but this should do it...

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
Redirect /directory/file.html http://domain.com/directory/file.html
share|improve this answer
    
thats for a folder. Will it work for a specific file URL? ALso, wouln't it be RewriteCond %{REQUEST_URI} ^.*/somefolder$ ? –  codecowboy Nov 2 '10 at 15:24
    
@codecowboy - Sorry, I was under the understanding you wanted it done for the entire directory. I have modified my answer. –  Jeremy Nov 2 '10 at 15:47
add comment

Add an additional condition before your rule that does the redirect to https:

RewriteCond %{REQUEST_URI} !=/wp-admin/admin-ajax.php

Which will prevent the rewrite/redirect from occuring for this file

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.