Remove trailing slash after .html extension
Remove trailing slash after .html extension
Remove trailing slash after .html extension
Conflict with Force SSL and Rewrite Rules
My Homepage Suddenly Disappeared and I Can’t Get It Back
I think I figured it out… almost. I needed to use WordPress’ own rewrite engine to define the rewrite rules so it recognizes what I’m doing. So I added this to my WordPress theme’s functions.php: add_action( ‘init’, ‘init_custom_rewrite’ ); function init_custom_rewrite() { add_rewrite_rule( ‘^show/([^/]*)/([^/]*)/?’, ‘index.php?page_id=2382&id=$matches[1]&n=$matches[2]’, ‘top’ ); } add_filter(‘query_vars’, ‘my_query_vars’, 10, 1); function my_query_vars($vars) { … Read more
Forcing HTTPS with WordPress on AWS
Whatever’s inside the “# BEGIN WordPress” and “# END WordPress” lines in your .htaccess file will be re-written by WordPress every time the permalinks are updated… I assume your plugins also use a similar mechanism. So make sure your own rewrites are always outside other people’s blocks.
404 error Additionally 403 Forbidden error on a URL
I contacted my host service again. They just gave me the same line to insert into my .htaccess file and I told them I already tried it and it didn’t work. I then showed them my .htaccess file and they deleted the whole part that concerned their server caching. Now server caching is completely off … Read more
The old domain is: www.example.com/newspage.asp?m=4&y=2015 and I need that URL, as well as that URL with different query paramaters to go to: example.com/news. So, you are also changing the host with this redirect (www subdomain to bare domain)? Otherwise, it just looks like you can ignore the query string. This is relatively trivial to do … Read more
Add the following code In your main hooks file (maybe in functions.php) add_action(‘init’, ‘my_custom_rewrite_rules’); Then add this function function my_custom_rewrite_rules() { // The rule // Input: archives/publications/countries/kenya // Output: archive-template.php?posttype=publications&taxo=countries&slug=kenya add_rewrite_rule(‘archives/publications/countries/([^/]+)/’, ‘archive-template.php?posttype=publications&taxo=countries&slug=$matches[1]’, ‘top’); // Flush the rules (to activate them) flush_rewrite_rules(); } To learn more about regex and rewrite rules, those links might help https://regexone.com/ … Read more