Solved

HTACCESS redirect, Wordpress

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
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 Import and export files in WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Click on Too…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…

756 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