How to have a custom URI path for specific page template

You need to add a rewrite rule to WordPress. There are several options to do it depending on your exact needs. Maybe the most general is using add_rewrite_tag() and add_rewrite_rule(): add_action( ‘init’, ‘cyb_rewrite_rules’ ); function cyb_rewrite_rules() { add_rewrite_tag( ‘%variable1%’, ‘([^&]+)’ ); add_rewrite_tag( ‘%variable2%’, ‘([^&]+)’ ); add_rewrite_rule( ^system/([^/]*)/([^/]*)/?’, ‘index.php?pagename=$matches[1]&variable1=$matches[2]&variable2=$matches[3]’, ‘top’ ); } Now, if the URL … Read more

How to fix .htaccess corrupted

Try reverting back to the default .htaccess file with the following code: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress If you’re using some other “flavor” of WP (e.g. multisite) view the htaccess docs on the … Read more

How to rewrite 404 to home page using htaccess?

There are a couple of ways to do this. If you’re using a custom theme or a child theme, add (or edit) a theme file called 404.php. The contents of that file should be: <?php header(“HTTP/1.1 301 Moved Permanently”); header(“Location: “.get_bloginfo(‘url’)); exit(); ?> You can add this code as a plugin, or put it in … Read more

Creating a copy of a website in a subdirectory, wp-admin redirect problem

If it’s a standard WordPress .htaccess file that won’t be your problem. I’m willing to bet you forgot to change the Site URL values when you imported the database. You can either edit it in the options table in your database or even in your wp-config file by adding define(‘WP_HOME’, ‘http://mainwebsite.com/test’); define(‘WP_SITEURL’, ‘http://mainwebsite.com/test’); to it. … Read more

Password protect directory but not files

As far as I know, the few files that you are talking about are always going to be the same, that means you can add exceptions to your .htaccess and “let them go through the cracks”. With an example of code from what you wrote so far may help us direct you on how to … Read more

Can’t access WP site over WiFi network

yes, it because wordpress use the server address from database get_option(‘siteurl’) and get_option(‘home’), so if you access the wordpress from IP Address the assets (js and css) will still loaded from localhost/wp/ that mean from 127.0.0.1 not the 10.0.0.1 the simple way to get dynamic url for your wordpress is defining the site_url and home_url … Read more

Local PC cache stays filled with old WordPress Site data

Unsurprisingly so since you tell browser to cache everything for 1 month by default (ExpiresDefault “access plus 1 month”). You should limit long caching times to static resources and leave pages served by WP out of it. My go to resource for .htaccess configuration is HTML5 Boilerplate. It works with WP nicely and correctly excludes … Read more

Relative links stop working after moving wordpress site from hosting to localhost

If you are in https://localhost/cc and use a relative lnk with href=”https://wordpress.stackexchange.com/login” (relative to current domain/site), the browser (not WordPress) will take you to https://localhost/login; if the link is href=”https://wordpress.stackexchange.com/questions/267557/login” (relative to current path) the browser will take you to https://localhost/cc/login. Relative links work like that, nothing to do with WordPress. That is why many … Read more