Remove year and month in URL using .htaccess

Assuming you have already changed the permalinks structure as @RickHellewell suggests, then you can do something like the following near the top of your .htaccess file (before the existing WP front-controller) to redirect the old URLs (with the stated format) in order to preserve SEO. RewriteRule ^\d{4}/\d\d/([a-z-]+\.html)$ /$1 [R=301,L]

Isolating WordPress to a subfolder

If you want your WP site to function completely in subfolder, just set it up there as usual (including .htaccess) and do not add any directives to the root. Setup of .htaccess in root, while WP is in subfolder, is only necessary if you want to have core files (and so admin area) there, but … Read more

Serve apache 404 for missing assets rather then wp 404 template WP_Rewrites

This very helpful page is unfortunately kind of burried on the codex: Basically mod_rewrite_rules hook will do the trick. function faster_htaccess_rules( $rules ){ $faster_rules = <<<EOD \n # BEGIN faster Apache 404 rules RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule \.(jpg|jpeg|png|gif|ico|swf|bmp)$ – [R=404,L] #Use instead for network sites #RewriteRule \.(jpg|jpeg|png|gif|ico|swf|bmp)$ – [nocase,redirect=404,last] # END faster Apache … Read more

Globally force SSL on all pages

To globally redirect all your pages to HTTPS add the following lines to your .htaccess: # Globally force SSL. RewriteCond %{HTTPS} off RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] This should be placed directly after RewriteEngine on if you have no previous rewrites.

Why “Settings->Permalinks” creates .htaccess file on nginx server?

WordPress tries to detect the webserver’s type by peeking into the global $_SERVER[‘SERVER_SOFTWARE’] variable. The Apache check is: $is_apache = (strpos($_SERVER[‘SERVER_SOFTWARE’], ‘Apache’) !== false || strpos($_SERVER[‘SERVER_SOFTWARE’], ‘LiteSpeed’) !== false); and the Nginx check is: $is_nginx = (strpos($_SERVER[‘SERVER_SOFTWARE’], ‘nginx’) !== false); You should therefore first check out: var_dump( $_SERVER[‘SERVER_SOFTWARE’] ); to see if it’s correct. Here … Read more