How to redirect subcategories to a page?
The $1 is grabbing the value from (.*)$, so to remove the subcategory, you’ll need to remove the flag RewriteRule ^category/symptoms/(.*)$ https://my-site/com/list/ [L,R=301]
The $1 is grabbing the value from (.*)$, so to remove the subcategory, you’ll need to remove the flag RewriteRule ^category/symptoms/(.*)$ https://my-site/com/list/ [L,R=301]
Almost all of your code is correct. I didn’t even know about the insert_with_markers function, and now I do, so thank you. In return, I believe I have your solution. get_home_path() is not defined when any of the hooks (init,wp, etc.) you mentioned are triggered. That function is defined in the admin-side “file.php”, which as … Read more
At the top of your .htaccess file before the WordPress front-controller try the following: RewriteRule ^$ /admin [R,L] This redirects https://example.com/ to https://domain.com/admin. This is a temporary (302) redirect.
When the directive is included as part of the WordPress directives It simply needs to go before the WordPress front-controller. In fact, you should not include this as “part of the WordPress directives” as WP itself tries to maintain this block of code and could override your custom directives in a future update. You should … Read more
whereis is not the right tool to find a file. whereis – locate the binary, source, and manual page files for a command You better use find /var/www/html/wptest2/ -name .htaccess to search for your .htaccess. Try to create a new .htaccess (touch /var/www/html/wptest2/.htaccess) and see if it’s possible.
Using insert_with_markers() function you can insert your rules only between WordPress comments e.i. # BEGIN WordPress and # END WordPress. So, you should use plain PHP to achieve your aim. Create your rules Read existing .htaccess and concatenate your and existing rules Write the file Here is a dirty example: <?php $str = “# BEGIN TEST\n# MY RULES\n# END TEST\n”; … Read more
There is a plugin that does exactly this: https://wordpress.org/plugins/multiple-domain-mapping-on-single-site Anyway, it would be nicer to have things under control with an understandable few lines of script, so I’m still open to answers
ExpiresByType text/x-javascript “access plus 1 month” ExpiresByType text/javascript “access plus 1 month” ExpiresByType application/x-javascript “access plus 14 days” In order to determine the correct mime-type to use you need to look at the Content-Type HTTP response header from your server (using your browser). The default for JavaScript files is application/javascript – which you’ve not included … Read more
There is not enough information to pin point the redirection issue. Here is what you can do to pin point the issue: Check if your new url is somehow different from old url. If its different then you will have to update your urls in database. Check and compare PHP versions of your old and … Read more
I think doing this within WordPress is probably the preferred approach, as mentioned in @Harrison’s answer, however, to answer your specific queries… RewriteEngine On Redirect 404 /article.html Aside: The RewriteEngine directive relates to mod_rewrite, however, Redirect is a mod_alias directive – so these two directives are unrelated. However, this should “work” with a default WordPress … Read more