Create rewriterules for different domains in htaccess file with WP multisite

If you wanted to target a specific domain then you need a condition (RewriteCond directive), preceding the RewriteRule that checks for the specific domain (Host: header). For example: RewriteCond %{HTTP_HOST} ^domainb\.com [NC] RewriteRule ^i-like-([a-zA-Z0-9-]+)/$ wp-content/themes/customtheme/custom-pages/ilike.php?like=$1 [L] The HTTP_HOST server variable contains just the Host: header sent in the request. Reference: http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritecond

Why does chrome keep downloading a file instead of running the site?

What I do On receipt of WordPress files and Db install in my localhost directory (I use EasyPHP Dev server) I then install Db and change wp-config.php to connect to local db etc. Then copy .htacces to htaccess.back Edit .htaccess to point at local dir structure (in this case find “~porterp6” and replace with “wordpress2” … Read more

Use htaccess to redirect WordPress to static website in a subfolder

If you want an external redirect from /2016/<anything> to /2016/a/<anything>, then you can do something like the following before the existing WordPress directives (ie. before # BEGIN WordPress) in your /2016/.htaccess file: RewriteCond %{REQUEST_URI} ^/(\d{4})/(.*) RewriteRule !^a/ /%1/a/%2 [R,L] The negated RewriteRule pattern prevents the redirect from occurring when the URl-path already starts with a/ … Read more

Add htaccess rules with insert_with_markers at beginning of htaccess

Using insert_with_markers() function you can insert your rules only between WordPress comments e.i. # BEGIN WordPress and # END WordPress. So, you should use plain PHP to achieve your aim. Create your rules Read existing .htaccess and concatenate your and existing rules Write the file Here is a dirty example: <?php $str = “# BEGIN TEST\n# MY RULES\n# END TEST\n”; … Read more

Special domain for a page

There is a plugin that does exactly this: https://wordpress.org/plugins/multiple-domain-mapping-on-single-site Anyway, it would be nicer to have things under control with an understandable few lines of script, so I’m still open to answers