Forum Moderators: phranque

Message Too Old, No Replies

Remove info from end of URL

         

wedgin

6:19 pm on Mar 13, 2008 (gmt 0)

10+ Year Member



This is probably dead simple, but I can't seem to find an article that addresses exactly what I need done. I already have an existing htaccess page with mod_rewrite rules applied working on my server.

I need an htaccess rule to turn this URL
http://www.example.com/archive/2008/02/29/Article_Name_Here/main_feed
into this URL
http://www.example.com/archive/2008/02/29/Article_Name_Here

This will need to be a general rule to convert all incoming URLs that have this main_feed bit attached to it, not just a single instance.

Any help would be greatly appreciated. Thanks

[edited by: encyclo at 12:57 am (utc) on Mar. 14, 2008]
[edit reason] switched to example.com [/edit]

g1smd

8:23 pm on Mar 13, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Are you looking for an external redirect from one URL to the other URL, or are you looking for an internal rewrite to convert that URL into an internal server filepath?

wedgin

8:51 pm on Mar 13, 2008 (gmt 0)

10+ Year Member



I don't actually know which would be the better route. I would think rewriting it makes sense, but I could be wrong. The issue I have is that I have my CMS outputting /main_feed at the end of all the local URLs. This is an issue I've tried to solve but to no avail. So instead of changing that, I decided to take another tact and rewrite the URL as it comes back to the site. I fear I've been losing a fair amount of traffic because of this issue as my RSS subscriber numbers have been climbing.

g1smd

12:47 am on Mar 14, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



A redirect changes the browser URL bar to a new URL.

A rewrite connects a URL to an internal filepath.

They perform different roles.

wedgin

12:52 am on Mar 14, 2008 (gmt 0)

10+ Year Member



Okay, if I need a redirect then, how do I direct all traffic going to URLs with /main_feed at the end to the same address minus the /main_feed?

jdMorgan

3:19 am on Mar 14, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



See Apache mod_alias, RedirectMatch directive.
Or see Apache mod_rewrite, RewriteRule directive.

Our Forum charter and our Library may be of interest to you as well.

Jim