Solved

HTACCESS redirect, Wordpress

Posted on 2016-09-10
6
50 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 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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…
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…

752 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