Questions tagged [redirect]

"HTTP Redirection" – the process by which a request for one URL is automatically replaced by a request for a different, usually related, URL.

Filter by
Sorted by
Tagged with
14
votes
2answers
12k views

Redirect function inside a Shortcode

I am developing a free plugin for connection a external support system to WordPress to be able to authenticate users on WordPress. For this, currently from the external system, the user is sent to ...
5
votes
3answers
6k views

Creating 301 Redirects for Post, Page, Category and Image URLs?

I fear this may be too much to ask here, so if so, please feel free to tell me of another place to learn. Help with Redirections I'm cleaning up a badly developed site and migrating wordpress from a ...
43
votes
6answers
63k views

How to force a 404 on WordPress

I need to force a 404 on some posts based on conditions. I managed to do it ( although I don't know if I did it the right way) and I'm a getting my 404.php template to load as expected. My code: ...
22
votes
4answers
44k views

Redirect Restricted Page to 404

Is there a way to show a 404 page if the current logged in user does not have the right clearance to view the page? I am looking for a PHP method, something like if( !current_user_can('administrator')...
16
votes
4answers
92k views

How to redirect non-logged in users to a specific page?

How to redirect non-logged users requesting for a specific page/URL to another page/URL and display a message like "for members only". I know its quite easy to code using !is_user_logged_in() ...
9
votes
4answers
4k views

How to show a single post on the front page but have normal paging?

I would like to have a single post on my front page (always the latest), but let normal paging work. So the front page has post 1, the next page should have post 2-11 (1-10 is fine too), then 12-21 or ...
7
votes
2answers
4k views

Catch 404 after changing permalink structure from /%postname%/ to /%category%/%postname%/

I made a site some time ago and after some days some posts were indexed by search engines. Today I changed the permalink structure from /%postname%/ to /%category%/%postname%/. After that, when ...
16
votes
7answers
57k views

Redirect user to original url after login?

I have a function that redirects users to the login page (home) if they're trying to access any other page without being logged in, here's how it works: function restrict_access_if_logged_out(){ ...
6
votes
2answers
11k views

Making a plugin file accessible via url rewrite?

In my WordPress plugin I have a php file that generates some stats about the blog and outputs it as a simple text file. To access WordPress functions I've included this at the top of the file: define(...
6
votes
1answer
4k views

Changing attachment urls?

How can I change the format of attachment page urls from /[post-url]/[attachment-name]/ to /media/[attachment-name]/? I understand that I can override the output of get_attachment_link via the ...
8
votes
2answers
4k views

Disable ONLY URL auto complete, not the whole canonical URL system

I have a blog with several pages in some category "projects" that are structured/named like this: /projects/project-2012 /projects/project-2013 /projects/project-2014 /projects/project-2015 When a ...
8
votes
1answer
6k views

301 redirect instead of 404 when URL is a prefix of a post or page name?

hey all! i have an odd problem with URL routing. when i request a URL that doesn't exist, e.g. http://localhost/foo, wordpress correctly returns a 404. however, if that URL is a prefix of a post or ...
4
votes
4answers
43k views

How to redirect a sucessful registration to a page template?

Each time I register I end up in the wp-login page (back-end): Is there any way of redirecting the users who register to a page template (front-end)?
10
votes
3answers
13k views

Redirect entire website to a single page

I need to redirect a whole WordPress site to a single WordPress page. A sort of maintenance mode, but the redirect has to go to a published WordPress page. Unfortunately, the maintenance page I need ...
2
votes
4answers
10k views

How to redirect all requests to wp-login.php?

I created some custom login/registration template pages and now I want that every request to wp-login.php to be redirected to a custom url. Now I have something like this: add_action('init','...
15
votes
4answers
17k views

Disable Wordpress URL auto complete

I recently noticed that Wordpress tries to auto-complete a URL when it's not submitted in its entirety. E.g. I have a post URL that looks like this: http://www.mysite.com/some-post-title If I browse ...
6
votes
1answer
7k views

Stop Wordpress from “guessing” redirects for nonexistent URLs

Wordpress sometimes "guesses" a redirection for a nonexistent page slug if the slug is at the beginning of another URL. After some searching, my hypothesis is that this part of the canonical ...
10
votes
2answers
13k views

My wordpress multisite homepage redirects to signup page

So I just setup my website fightify.com and as you will see, visitors are automatically redirected to a signup page, which shouldnt be happening. This only occurs if the domain is typed without the ...
0
votes
1answer
996 views

Can Not Redirect from Plugin-Registered Admin Page

I am doing the following in my plugin: Register a custom admin page and in the callback function (the last parameter of add_submenu_page) Redirect to another page However, when I open the custom ...
18
votes
7answers
25k views

How do I skip wordpress's 404 handling and redirect all 404 errors for static files to 404.html?

How do I skip wordpress's 404 handling and redirect all 404 errors for static files to 404.html? I read and it seems its not possible when using permalinks? The objective is to reduce the server ...
16
votes
2answers
47k views

How to prevent automatic redirection?

Wordpress has a feature whereby it will automatically redirect your URLs if it percieves them to be written wrongly. Here is an example: I have a page called my-page If I go to: www.mysite.com/...
4
votes
2answers
13k views

How to disable Multisite sign-up page?

If we try to access a non-existant Multisite site, e.g., http://site1.example.com or http://example.com/site1/, we are redirected to http://example.com/wp-signup.php?new=site1. How to block this and ...
6
votes
4answers
33k views

Redirect to referring page after logging in

I am not using any custom login plugins or any bespoke code. A few of my pages have got this bit of code in them at the very beginning. <?php if(!is_user_logged_in()) wp_redirect('/...
4
votes
1answer
3k views

Passing variables through permalink structure

I have a WordPress page which is accessible via /accommodation/. What I want to be able to do is pass in a parameter using the URL - ie going to /accommodation/value1/ would load the same page as /...
1
vote
5answers
19k views

Redirect loop (only for multisite network admin)

I can log into http://localhost/wp/wp-admin/ fine, but logging into http://localhost/wp/wp-admin/network/ produces a network redirect loop (ERR_TOO_MANY_REDIRECTS). The site also loads just fine even ...
13
votes
7answers
28k views

WordPress localhost site redirect to live site

I have download the code and export the database from server and setup the site on my localhost also I have been changed the home and site URL in wp_options table I am able to login at wp-admin but ...
1
vote
2answers
355 views

How do I skip wordpress's 404 handling?

I want to extend my website in a way that is parallel to the wordpress theme. Example: My website with wordpress is at: www.mywebsite.com By ftp I added a directory named test, in which there is a ...
0
votes
3answers
15k views

How to: 301 Redirect /category/ to /customname/

I've changed our "category base" in WP settings from the default "category" to "customname". Now there are 404 errors to links containing the old category slug eg. mysite.com/category/names What do ...
19
votes
3answers
35k views

Admin Page Redirect

Is it possible to redirect users to an admin page if they access another admin page? For example if they a user ever hits "all pages" /wp-admin/edit.php?post_type=page they would get redirected to "...
1
vote
1answer
314 views

Redirect all users, except network administrators, from the main site to a subsite

I have a WP Multisite / Multi Network installation. What I need is to redirect all non-logged and also all logged in users, except logged in network administrators, from the main site example.com (...
1
vote
6answers
444 views

Pages 404 in wordpress

First of all, I am very new to wordpress and know almost nothing about it. When I create the page foo using in wp-admin, I get the message that the page is created. When I click on view page, it 404s....
1
vote
1answer
7k views

How to redirect users to custom lostpassword page?

How to redirect users to custom lostpassword page when they click on the Error: Lost your password?. Because I set a redirect for wp-login.php to my custom login page. when a user click on Error: Lost ...
1
vote
3answers
1k views

flush_rewrite_rules not working on plugin deactivation, invalid URLs not showing 404

i'm just about to release a community plug-in and have a few last anoying issues. First, whenever i visit a page that would not be valid for the plugin, www.mydomain.com/forms/tester it will take me ...
0
votes
2answers
4k views

How to? Redirect /category/sci-fi/ to /category/scifi/?

I changed the wordpress category slug from "sci-fi" to "scifi" a few months back by accident. How can I redirect /category/sci-fi/ to /category/scifi/ so that /category/sci-fi/page/2/, /category/...
0
votes
1answer
2k views

Error 310 too many redirects after switching domains

I'm at a loss here. My site is http://www.kgstiles.com and about 70% of my pages now result in a 310 error. There doesn't seem to be any pattern to the error, but one thing I thought was interesting: ...
0
votes
2answers
830 views

Changing pemalink structure to /%post_id%/%postname%/

I'm currently using permalink structure: /%year%/%monthnum%/%day%/%postname%/ I want to change that to: /%post_id%/%postname%/ I expect it to be: faster (database is sorted by post_id?) shorter ...
0
votes
1answer
2k views

How to redirect search result page to post

I'd like to redirect a search result page URL to a specific post. I've tried doing a 301 redirect in the .htaccess but it is not working. As an example: I want to redirect permanently the URL http:...
0
votes
1answer
2k views

Wordpress overriding actual subdirectories

I have a site driven by Wordpress and a few custom directories that I've got at the top level. Some of these top-level directories work and the content inside of them are being read as expected. ...
21
votes
8answers
30k views

Resolve a custom post type name vs. page permalink conflict (same slug)

I have a custom post type called "visningshus", and also a Page with that slug. This is as it should (must) be. Currently, "http://my-site.com/visningshus" lists all posts of that type. I want to ...
19
votes
6answers
14k views

Disable front end to use as CMS only?

I'm using the WordPress database and back end to administer the news for my band's website and everything is working great however I'd like to disable the front end of WordPress itself. I have the ...
11
votes
4answers
7k views

Redirect Main Site to Subsite in Multisite Wordpress

I have multi-site wordpress, I want to redirect the main site to one of the sub-site but redirection in .htacecss gives error. Is there any way to redirect a main site to its sub-site. That looks not ...
6
votes
1answer
7k views

check first time login only

i want to display welcome message or redirect the user to my custom template when the user login for the first time only. After the user can visit the regular page of the site.
17
votes
3answers
18k views

Which hook should be used to add an action containing a redirect?

I want to build a plugin that grabs certain url params from the query string to build a new query string for the same page. I'm following the excellent the Professional WordPress Plugin Development ...
5
votes
5answers
16k views

Removing the redirect after changing a page's slug

On one of my pages I changed the slug to form a different URL. E.g. Old: http://example.com/old-slug New: http://example.com/new-slug WordPress has done it's thing of redirecting http://example.com/...
2
votes
2answers
6k views

How do I redirect upon login a specific user based on role?

I'd like to force a user to a specific page upon login based on their role using if ( current_user_can('contributor') ) and the main login function function wp_loginout($redirect = '', $echo = true)...
3
votes
2answers
5k views

Redirect to custom url when registration fails?

When I want to redirect the user after successful registration, I just use "registration_redirect" filter hook. How about when registration fails, which filter hook should I use? I looked into wp-...
8
votes
1answer
11k views

Login redirect to previous page

I have a custom login page at http://netballscoop.com/log-in/ When you fill the username and password it redirects you to the previous page you were on perfectly. When you click Log Out it redirects ...
7
votes
3answers
8k views

How do I programmatically generate a 404?

How can I get something like this to work? // in a plugin / theme: // This imaginary function will make WordPress think that the // current request is a 404. // Ideally this function could be ran ...
7
votes
3answers
9k views

User redirect to destination URL after login

Scenario: if user not login, user redirect to customize login page and redirect again to destination page after login. I don't use a function or plugin. This code to restriction page: if (!...
6
votes
3answers
19k views

Best Way to Redirect Category to Page and Hide Category

I have a category archive page at: http://mysite.com/news It displays an archive of items from the category 'news-article' I'd like to redirect any requests for http://mysite.com/category/news-...