homepage Welcome to WebmasterWorld Guest from 54.227.215.139
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Redirecting urls with special characters
getoffmyisland



 
Msg#: 4519976 posted 10:35 am on Nov 15, 2012 (gmt 0)


System: The following message was cut out of thread at: http://www.webmasterworld.com/apache/4518100.htm [webmasterworld.com] by incredibill - 2:52 pm on Nov 17, 2012 (PST -8)


and how would you redirect a url like this:

www.example.com/our-work/%ourworkcategories%/ (Bad request)

to:

example.com/our-work/

 

phranque

WebmasterWorld Administrator phranque us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4519976 posted 1:00 am on Nov 18, 2012 (gmt 0)

what have you tried?

getoffmyisland



 
Msg#: 4519976 posted 3:15 pm on Nov 20, 2012 (gmt 0)

I tried this, but it only works for /%20 or spaces

eg. when you want to redirect something like this:

www.example.com/our%20work

example:
Redirect 301 "/our work" "http://www.example.com/our-work"

but this doesn't work for bad requests like below.
www.example.com/our-work/%ourworkcategories%/

any help would be appreciated.

phranque

WebmasterWorld Administrator phranque us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4519976 posted 3:27 pm on Nov 20, 2012 (gmt 0)

you could probably get this working with the RedirectMatch Directive:
http://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirectmatch

however i would suggest using mod_rewrite instead of mod_alias.

mod_rewrite - Apache HTTP Server:
http://httpd.apache.org/docs/current/mod/mod_rewrite.html [httpd.apache.org]

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4519976 posted 8:08 pm on Nov 20, 2012 (gmt 0)

You will probably need to use mod_rewrite for the mechanical part. But the first thing you need to do is figure out exactly what bad URLs are involved, and where they are coming from.

If they are bogus URLs --ones that you didn't make yourself, and didn't come from typos on a site you like-- you don't have to redirect them at all. Let them go to a well-earned 404.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved