?
Solved

HTACCESS redirect, Wordpress

Posted on 2016-09-10
6
Medium Priority
?
58 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

719 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