Solved

HTACCESS redirect, Wordpress

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

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!
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. 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 : Go t…

803 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