Solved

HTACCESS redirect, Wordpress

Posted on 2016-09-10
6
25 Views
Last Modified: 2016-10-04
I have a category called publications. I have a slider on the home page that features the latest publications rotating through. When clicked, I would like for any of the linked publications in the slider to go to the main publications page.

the main publications category looks like this:

www.mysite.com/publications

specific URLs for individual publications look like this:

www.mysite.com/publications/architecture-dependent-stabilization-of-polyelectrolyte-complexes-between-polyanions-and-cationic-triblock-terpolymer-micelles

or

www.mysite.com/publications/tuning-cationic-block-copolymer-micelle-size-by-ph-and-ionic-strength

so I would like for any of the individual pubs to redirect back to the category archive because there is never a reason to view an individual publication.

Can someone help?
0
Comment
Question by:Ken McJohnson
  • 2
  • 2
6 Comments
 
LVL 12

Expert Comment

by:William Nettmann
ID: 41793240
if "there is never a reason to view an individual publication" why are they even there?

Maybe there is a whole different approach to address your requirements.
0
 

Author Comment

by:Ken McJohnson
ID: 41793249
sigh.  it's like this.

-this client is a professor of chemistry
-she submits articles to scientific journals and they are published.
-those entries consist of name, article title, date, citation, and journal name.
-old website had a single page that was a big long unmanageable list.
-new website, using a custom post types builder, I built a custom post type called "publications" so her admins could easily add single publications one at a time. They fill in the pre-defined blanks, and the output is autmatically formatted with necessary bold, ital, order, etc.

-These publications all display to an achive page in the same sort of list as the old website, only now the management and input of individual publications is much easier for the client.

-HOWEVER. She wants a slider on the home page showing the latest publications. No problem, I install a slider that pulls the latest publications from this unique post type. However, said slider's title display takes the user, if they click the title, to the individual post page which is useless because it containsn very little information other than what is contained on the list itself. I dont need or want people viewing these individual posts, just the list.

If there is no .htaccess means of redirecting these variable individual posts back to the archive, fine. But this is the second site I have submitted this question to where the logic of having specific posts has been questions rather than the solution to the issue being addressed.
0
 
LVL 12

Expert Comment

by:William Nettmann
ID: 41793264
Been playing with .htaccess without much luck - I suspect that it may cause a redirect loop.

You may need to filter the page content and do a string replace on the URL's in the slider, or hack the slider plugin and change the URL's there.
0
 
LVL 35

Accepted Solution

by:
Terry Woods earned 500 total points (awarded by participants)
ID: 41795761
Try this... I've done some testing on a similar example and it seemed to work for me.

RewriteEngine on
RewriteBase /
RewriteRule ^publications/. /publications [R=302,NC,L]

Open in new window


Note that the . character means at least one character is required after the / character, which should prevent an infinite loop. Once you've tested everything is working, you may want to change the temporary 302 redirect to a 301 (permanent redirect), but bear in mind some users' browsers can cache the redirect permanently so leaving it with a 302 can be a good idea.
0
 
LVL 35

Expert Comment

by:Terry Woods
ID: 41801210
Did you have any luck getting this working?
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
This article discusses four methods for overlaying images in a container on a web page
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now