How to create a redirect in the .htaccess file, with 2 exceptions

Try the following, before the existing WordPress directives: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule !^(abc|abc-def-g)$ / [R,L] This states that for any URL that is not /abc or /abc-def-g and which does not map to a physical file or directory (ie. your static resources, images, CSS, JS, etc.) then redirect to the homepage. The … Read more

How To Fix A Redirect Chain

The non-www to www redirect is most certainly being handled (later) by WordPress. Your existing redirect in .htaccess is HTTP to HTTPS only, on the same host – which is actually the preferred (read: necessary) way if you have any plans to implement HSTS in the near future. So, this is not necessarily an “error”. … Read more

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

SEO Friendly URL on dynamic product page produced via shortcode

Your rule needs a little tweak. You also need to add id to valid query vars. function wpd_test_rule() { add_rewrite_tag( ‘%id%’, ‘([0-9]+)’ ); add_rewrite_rule( ‘^product/([0-9]+)/([^/]+)/?$’, ‘index.php?page_id=5&id=$matches[1]’, ‘top’ ); } add_action( ‘init’, ‘wpd_test_rule’ ); Note that WordPress doesn’t put query vars in $_GET, you’ll need to adjust your code to use get_query_var(‘id’) to fetch the value. … Read more

How to redirect specific URL to Subdomain

To redirect example.com/pagecategory/page-single to pagecategory.example.com/page-single, where pagecategory is entirely variable then you can do something like the following at the top of your .htaccess file: RewriteEngine On RewriteCond %{HTTP_HOST} ^example\.com [NC] RewriteRule ^([a-z]+)/([\w-]+) https://$1.%{HTTP_HOST}/$2 [R,L] I’ve limited the “subdomain” (ie. pagecategory) to just the lowercase characters a-z – this is saved in the $1 backreference. … Read more

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