How to write .htaccess so that https is on for subpages only but not the home page

Presumably your .htaccess file is located in the /abc subdirectory? In which case you can do something like the following to force HTTPS on all sub-pages, except the homepage: This needs to go at the very top of your .htaccess file: RewriteCond %{HTTPS} !on RewriteRule !^(index\.php)?$ https://example.com%{REQUEST_URI} [R=302,L] This assumes that the SSL cert is … Read more

How disable canonical redirect wp-signup

The <Files> directive is used to target specific files on the filesystem, not URLs. To change this to target any URL that starts /wp-signup then use mod_rewrite instead. For example: RewriteRule ^wp-signup – [F] This must go at the top of your .htaccess file.

External content won’t load in iframe in Safari

X-Frame-Options: sameorigin By itself (and in older browsers) this would certainly deny access. However, in compliant browsers you would expect the Content-Security-Policy: header to override this. Assuming you have control over this external content, have you tried setting this header to: X-Frame-Options: allow-from https://example.com Or X-Frame-Options: sameorigin, allow-from https://example.com (Although Safari may not support the … Read more

htaccess, site and staging in subdirectories

Assuming the /wp2 subdirectory containing the staging site has its own WordPress .htaccess file (with the standard WordPress front-controller, see below). Then the .htaccess in the document root should contain something like the the following, above any existing directives, to rewrite all requests to the wp2 subdomain to the /wp2 subdirectory: RewriteEngine On RewriteCond %{HTTP_HOST} … Read more

WordPress – Promoting A Dev Build In A Subdirectory To Production / Root Directory

…just point Apache’s root directory to /public_html/development If you do this, I would seriously consider renaming “development” to “live” or something more meaningful, otherwise it’s going to get confusing going forward. Then you can create an .htaccess file in the document root with just the following mod_rewrite directive to rewrite everything to the /live subdirectory … Read more

Remove /sites/25/ from image URLS

I assume you want to internally rewrite the URL, rather than externally redirect the request… To rewrite the image URL-path to remove /sites/25 for the espanol subdomain only then try something like the following using mod_rewrite at the top of the .htaccess file, before the WordPress front-controller: RewriteCond %{HTTP_HOST} ^espanol\. RewriteRule ^(wp-content/uploads)/sites/25/(\d{4}/\d\d/[\w-]+\.jpg)$ /$1/$2 [L] Following … Read more

how to redirect 301 my old search query string to wordpress search query string?

Try something like the following at the top of your root .htaccess file (before the WordPress block): RewriteCond %{QUERY_STRING} ^search=([^&]*) RewriteRule ^cgi-bin/mt/mt-search\.cgi$ /?s=%1 [R=301,L] %1 in the RewriteRule substitution is a backreference to the captured group in the preceding CondPattern (ie. the value of the search URL parameter – “WORDS”). Clear your browser cache before … Read more