New answers tagged

0

from what I see the issue might be in the redirections you are making and how you are making them. I did some research and you can use this (it is Ask Rubi group that has an article on the topic) to learn more about the redirections.


1

If this image does not exist then the request will be rewritten to the WordPress front-controller before your redirect occurs. Try the following instead using mod_rewrite at the top of the .htaccess file, before the # BEGIN WordPress code block: RewriteRule ^(wp-content/uploads/2021/09)/image-1\.png$ https://%{HTTP_HOST}/$1/image-2.png [R=302,L] The $1 ...


1

Or you could just add the relevant directive to the top of the .htaccess file directly. For example: RewriteRule ^([^/]+)\.html$ /product/$1 [R=302,L] This matches /anyname.html (as in your example), but not /foo/bar/anyname.html.


0

So. I decided to work with the following code (complete aware, that this can be optimized) At first I get the url, which brings me to the 404 template. I check, if it contains the term "node", which indicates, it is a link pointing at an entry of the drupal version, than I split it up, until I get the number following the "node/". Then I ...


0

RewriteBase /wp/ RewriteCond %{query_string} ^token=12345 RewriteRule (.*) /$1? [R=301,L] but it redirects me to: www.example.com/custom-taxonomy/somepagename There are two issues here with the redirected URL: The /wp prefix is missing. The trailing slash is missing. To fix #1 you can either: Hardcode the /wp prefix in the substitution string (as is ...


0

Here's an idea for you: If you create a script for importing the content from Drupal, using the node ID as a suggested ID for the new WP post (Otto has explained how to do this here: How can I assign post a specific ID on creation?), this would lead to your nodes being accessible in the new site on https://yoursite.com/?p=XXX for each of them, which will be ...


1

Assuming state and city are variable path segments, so you are essentially redirecting /investments/<one>/<two>/ to /investments/<two>/ then try the following at the top of your .htaccess file: # Redirect "/investments/<one>/<two>/" to "/investments/<two>/" RewriteRule ^(investments)/[^/]+/([^/]+)/$ /$1/...


0

I'll add another answer because the rule is only a part of the problem. Here is what I have tested and is working : <?php class BadRewritesRules { public function __construct() { add_action('init', [$this, 'custom_post_types_rewrite_rules']); remove_filter('template_redirect', 'redirect_canonical'); } public function ...


-2

You should keep the slug page in your URL. It is way more easier and better to read. Here is something correct : add_rewrite_rule( '(blog)/page/([0-9-]+)[/]?$', 'index.php?pagename=$matches[1]&paged=$matches[2]', 'top' );


Top 50 recent answers are included