Mobile app version of vmapp.org
Login or Join
Rivera981

: How to add an exception to this rewrite rule 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$

@Rivera981

Posted in: #Apache #UrlRewriting

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 ^(.+)$ %{SERVER_NAME}// [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!

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Rivera981

2 Comments

Sorted by latest first Latest Oldest Best

 

@Gonzalez347

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

10% popularity Vote Up Vote Down


 

@Phylliss660

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

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
Redirect /directory/file.html domain.com/directory/file.html

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme