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

htaccess rewrite for author query string when WP is in subfolder

The question is about doing this with .htaccess, but why not disabling author pages from within WordPress instead? This would achieve the same result while making the subdirectory concern irrelevant altogether (and also works regardless of permalink structure settings) Sample code that sets all urls to author pages to a 404 error: add_action( ‘template_redirect’, function() … Read more

404 error on subcategory pages

The cause of this issue for future reference was the ‘.’ in the category base, which was added to resolve a previous issue. Removing this and using /category/postname (per question) works, so will look for an alternative resolution to the category base issue.

Plugin to edit htaccess file

Here are a couple of options: WP htaccess Control – will let you manually edit your .htaccess file All-in-one htaccess Plugin – will let you dynamically create an .htaccess file based on which modules/features you want set up When all else fails, turn to Google …

multisite htaccess 301 redirects

Okay, RewriteEngine On RewriteBase / # Blog ID1 Rewrite Rules RewriteCond %{HTTP_HOST} ^(www\.)?primary-domain.co.uk [NC] RewriteRule ^about/careers/$ contact/careers/ [R=301,NC,L] RewriteRule ^glossary.html$ sitemap/ [R=301,NC,L] # Blog ID3 Rewrite Rules RewriteCond %{HTTP_HOST} ^(www\.)?mapped-domain3.co.uk [NC] RewriteRule ^about/$ http://primary-domain.co.uk/about/ [R=301,NC,L] RewriteRule ^news/$ http://primary-domain.co.uk/news/ [R=301,NC,L] This works, there’s 158 more lines to my particular site but you get the idea. I … Read more

Fixing external image urls

Since the request is sending to the blogspot server, no .htaccess wont wont. You could filter your post content output: add_filter(‘the_content’, function($the_content) { return str_replace(‘/s400′,’/s1600′,$the_content); }); Or you could edit modify the database global $wpdb; $wpdb->query(“UPDATE $wpdb->posts SET `post_content` = REPLACE(`post_content`,’/s400′,’/s1600′);”); Or do it in mysql UPDATE wp_posts SET `post_content` = REPLACE(`post_content`,’/s400′,’/s1600’; assuming wp_posts is … Read more

Multisite: Develop locally using production images with .htaccess

The following .htaccess to rewrite example … RewriteCond %{REQUEST_URI} ^/wp-content/uploads/[^\/]*/.*$ RewriteRule ^(.*)$ http://example.com/$1 [QSA,L] Just to note… this will result in an external redirect (as if R=302 was included on the RewriteRule directive), not simply a “rewrite” (as is suggested) – even without the R flag. So, the browser will issue two requests for every … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)