Redirect from ip to domain

WordPress does not create a complete new .htaccess. It just rebuilds the part between the WordPress markers: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L] RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress Any rule placed outside of this block … Read more

ow to change cutsom page url of wordpress site using htaccess

At first, you shouldn’t use .htaccess directly when working with WordPress. WordPress has powerful rewrite API allowing you to do the stuff from plugins or theme’s functions.php If you need the id=floos on more than one page, consider using rewrite endpoints: function makeplugins_add_json_endpoint() { add_rewrite_endpoint( ‘floos’, EP_PAGES ); } add_action( ‘init’, ‘makeplugins_add_json_endpoint’ ); To determinate, … Read more

Use two different index pages

You can’t set DirectoryIndex to prototype.php and expect everything else to work correctly. DirectoryIndex is not just a “landing page”. A lot of requests go through that file. I think you are making this more complicated than it needs to be. Put your code for prototype.php into a WordPress custom theme template file. Create a … Read more

.htpasswd asking for authentication on home page

Be aware, the AJAX file admin-ajax.php is in the wp-admin directory too. So I guess your site is using AJAX to send requests in the background to the admin directory. Clicking it away lets the AJAX request fail, but the error isn’t displayed. Change the .htaccess to: AuthType Basic AuthName ‘YOUR_AUTH_NAME’ AuthUserFile PATH_TO_HTPASSWORD <Files ‘*’> … Read more

How to Deny Access to No Referrer Requests on Multiste with Mapped domains

You could hook intop pre_comment_on_post: add_action( ‘pre_comment_on_post’, function(){ if ( empty ( $_SERVER[‘HTTP_REFERER’] ) ) exit; }); But … be aware, not all requests without an referer are actually spam posts. Some firewalls and proxies strip this field. And most automated spam comes with a Referer field filled with the name of the spammed domain. … Read more

Custom url rewriting

[answer updated as wanted] It’s better to hook your function to generate_rewrite_rules so you won’t have fall into infinite loops and flushing rewrite rule on every request. So you can do this: function add_my_rules($wp_rewrite) { $new_rules = array( ‘^cityprofile/\?city=(Sydeny|Melbourne|Brisbane)$’ => $wp_rewrite->preg_index(1) // for 3 cities ); $wp_rewrite->rules = $new_rules + $wp_rewrite->rules; } add_action(‘generate_rewrite_rules’, ‘add_my_rules’); and … Read more

Will deleting WP’s code in .htaccess cause problems?

Adding the [L] flag to the [NC,R=301] piece (ie, [NC,R=301,L]), which tells the RewriteEngine that the RewriteRule is the last one for the block of RewriteConds, apparently solved the problem. RewriteEngine on RewriteCond %{HTTP_HOST} name.com RewriteCond %{REQUEST_URI} ^/(1[0-9]{3}|200[0-9]|201[0-3]) RewriteCond %{REQUEST_URI} !/2013/12 RewriteRule ^([0-9]{4})/([0-9]{2})/(.*)$ http://v2.name.com/$1/$2/$3 [NC,R=301,L] # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule … Read more