New answers tagged

0

Try something like the following at the top of your .htaccess file, before the WordPress front-controller: RewriteRule (.+/)amp$ /$1 [R,L] This redirects a request for /<something>/amp to /<something/ - removing the "amp" suffix. Note that this is a 302 (temporary) redirect.


0

I know it's late, but I am posting the solution so that it can help someone in need at the moment. This is what I am doing and it is working perfectly. function redirect_user_tologin(){ global $post; $post_slug = $post->post_name; if(!is_user_logged_in()){ if($post_slug == 'my-account') { //can add multiple conditions //create ...


0

This will require a bit of coding. The best way to do this with the use of query paramters. You'll need to add some query paramters to the end of each of your links. Then, on the landing page, check the query paramaters (which should have different values depending on which link you clicked) and display the content based on the vlaues in the query string. ...


0

The problem was that a table called "redirection" had a saved redirection that was stopping us from opening the site directly. So, as someone was typing site.com -> it was redirecting it to staging.site.com. To solve for this, we used a plugin called "Search & Replace" and searched where all "staging.site.com" was found, and then found the tables where ...


2

A post has a js redirection script. Full Stop. If you're redirecting anything in JS, start from there as the first failure point. There's really no reason anything should be redirecting from JS on the front end. There are plenty of redirection plugins out there to handle any redirection rules you might need. Delete the script, redirect the page properly, ...


1

If that redirection script is written in the content section of the post, it is probably being called in with the rest of the content on the category page. You could add a URL check to your javascript that would look like this: if(document.URL.indexOf("foo_page.html") >= 0){ window.location.replace("http://www.w3schools.com"); } And add in your ...


0

I am speculating here after reviewing your logic/comments above, yet let's try as follows Possible issue: During login, although you are setting the auth cookie, you are not setting the current user and this is potentially the cause of the break-down upon logout due to is_user_logged_in returning a false-positive/negative result. Possible resolution: In ...


0

I can't comment so I'm leaving this answer. As a follow up to the fantastic research done by @Borislav there is another SE thread that is related, with several potential fixes: Site Redirecting to wp-signup.php Ultimately, all the redirect issues with WordPress Multisite seem related to siteurl and home which even if properly hardcoded (e.g. using WP_HOME ...


0

Solved. Someone put a redirection code on the theme itself


1

Look in your wp_options database table for the siteurl and home options and check these are using your local URL. As Captain S commented, these can also be overridden in your wp-config: define('WP_HOME', 'http://www.localsite.test'); define('WP_SITEURL', 'http://www.localsite.test');


0

check your wp-config.php if you have defined 'WP_HOME' and/or 'WP_SITEURL'. Setting these values will override the wp_options table values. If that doesn't help I recommend the tool database search and replace. Hope that helps.


0

I've fixed it with the following code: /** * Redirect '/tag/[0-9]/{tag_name}/' to the correct tag. */ add_filter('request', function($qv) { if (array_key_exists('category_name', $qv) && preg_match('/(tag\/)([0-9]*)/', $qv['category_name'])) { $qv = [ 'tag' => $qv['name'] ]; } return $qv; }); I'm not ...


0

Try using this in Your .htaccess: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.html -f RewriteRule ^(.*)$ $1.html alternatively You could use in your php code: wp_redirect(str_replace('.html', '', $url))


0

I find and use below code for when user in cart page and cart not empty: add_filter('woocommerce_get_checkout_url', 'dj_redirect_checkout'); function dj_redirect_checkout($url) { global $woocommerce; if(is_cart() && !is_user_logged_in() ){ $checkout_url = 'digits login url'; } else{ $checkout_url='https://...


Top 50 recent answers are included