Drawbacks to using Options -Indexes

There are some legitimate use cases for enabling Indexes but they’re probably not applicable to most sites (especially WordPress sites). For example Indexes are helpful on file storage mirrors where you want to provide readonly access to a subset of folders & files without having to build your own UI. As a best practice, yes, … Read more

301 Redirects Result in 404 for WordPress Search Query Strings

Redirect 301 /search?q=avengers https://www.example.com/?s=avengers You can’t match the query string with a mod_alias Redirect (or RedirectMatch) directive. The Redirect directive matches the URL-path only. You need to use mod_rewrite and match against the QUERY_STRING server variable. For example: RewriteCond %{QUERY_STRING} ^q=avengers$ RewriteRule ^search$ /?s=avengers [R=301,L] This will need to go before the existing WordPress front-controller. … Read more

Redirect only posts to New Domain

Thanks everyone for taking time to look and get it solved. After so many trials and try-catch, I managed to achieve the above task by adding these lines to .htaccess RewriteCond %{HTTP_HOST} ^(www\.)?prsblog\.com$ [NC] #RewriteCond %{REQUEST_URI} !\.(jpe?g|png|gif|ico)$ [NC] RewriteCond %{REQUEST_URI} !wp-admin RewriteRule ^(.*)$ https://www.pyarb.com/$1 [L,R=301] This solved my problem for instant.

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

403 error on admin login page

I managed to enter the admin page finally! So I added these two lines to wp_admin.php: define(‘WP_HOME’,’http://example.com’); define(‘WP_SITEURL’,’http://example.com’); afterward deleted the .htaccess file, then deleted browsing history, cleared cache and cookies. After all of this I could enter the admin page. Then I went to options/general and options/permalinks and saved the setting, it generated a … Read more

WordPress .htaccess blocks mine?

Try resetting the default error document at the start of your .htaccess file: ErrorDocument 410 default If you have a custom 410 error document defined elsewhere in your server config then this could end up being routed by WordPress. (I’ve encountered some shared hosts that (for some reason) define a custom “default” ErrorDocument in the … Read more

How can I enable keep alive (Not accessing to Apache)

Check out wp_headers filter: /** * Filter WordPress headers before sent * * @see https://developer.wordpress.org/reference/hooks/wp_headers/ */ function wpse_289493($headers, $wp) { foreach ($headers as $key => $value) { if (‘connection’ === strtolower($key)) { unset($headers[$key]); } } $headers[‘Connection’] = ‘Keep-Alive’; return $headers; } // Add filter add_filter(‘wp_headers’, ‘wpse_289493’, 10, 2);

Url Rewriting a dynamic wordpress page

thanks for you reply, So after much digging, it’s working : function myplugin_rewrite_tag_rule() { add_rewrite_tag( ‘%symbol%’, ‘([a-zA-Z0-9_]+)’ ); add_rewrite_rule( ‘^crypto-monnaies/([a-zA-Z0-9_]+)/?$’, ‘index.php? pagename=showcoin&symbol=$matches[1]’,’top’ ); } add_action(‘init’, ‘myplugin_rewrite_tag_rule’); function add_query_vars( $query_vars ) { $query_vars[] = ‘symbol’; return $query_vars; } add_filter( ‘query_vars’, ‘add_query_vars’ ); Please note that if you dynamic page is a second level page, you have … Read more

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