Check request URL for pattern

how’s the URL structure? Could you paste here? If you’re URL follows this structure: http://example.com/?foo=bar, so you need to get the foo value with this: if ( isset( $_GET[‘foo’] ) ) { $bar_value = $_GET[‘foo’]; // Do whatever you want with $bar_value. } else { // Do something else. } If that doesn’t work, you … Read more

How do I write the link from front-page.php to home.php?

There really should be a simpler way to do it but you kind of need to know that WordPress stores both the Front Page ID and Blog Page ID in the options table. So, to get the URL of the blog you need to use both get_permalink() and get_option() in conjunction. <a href=”https://wordpress.stackexchange.com/questions/270158/<?php echo esc_url( … Read more

WordPress redirects non-existing url to existing ones – how to disable

This question is a duplicate of Disable ONLY URL auto complete, not the whole canonical URL system Try this filter function remove_redirect_guess_404_permalink( $redirect_url ) { if ( is_404() ) return false; return $redirect_url; } add_filter( ‘redirect_canonical’, ‘remove_redirect_guess_404_permalink’ ); Or this plugin: https://wordpress.org/plugins/disable-url-autocorrect-guessing/

Pagination url canonical problem

You have to install Yoast SEO and then add to functions.php: function return_canon () { $canon_page = get_pagenum_link(1); return $canon_page; } function canon_paged() { if (is_paged()) { add_filter( ‘wpseo_canonical’, ‘return_canon’ ); } } add_filter(‘wpseo_head’,’canon_paged’);

Preserve Domain Alias

You need to set the canonical hostname (ie. with www) in the WordPress dashboard… Under Settings > General and set the appropriate “WordPress Address (URL)” and “Site Address (URL)” properties. Alternatively, these values can be hardcoded in wp_config.php by defining the WP_HOME and WP_SITEURL constants respectively. Reference: https://codex.wordpress.org/Changing_The_Site_URL SSLOptions +StrictRequire SSLRequireSSL SSLRequire %{HTTP_HOST} eq “example.com” … Read more

How to redirect URL with subfolder to the same URL but without subfolder?

Assuming you have already moved your site from the /blog subdirectory to the document root and changed the URL structure within WordPress itself, so the /blog subdirectory is not included in all your internal links, then you can either do a simple redirect (using mod_rewrite) in the /blog/.htaccess file (preferable): RewriteEngine On RewriteRule (.*) /$1 … Read more

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