Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Website and Server Administration Forum


You are currently viewing our Website and Server Administration Forum as a guest. Please register to participate.
Login



Reply
How to add a wildcard in RedirectMatch 301
Old 07-23-2012, 03:41 AM How to add a wildcard in RedirectMatch 301
TWD
TWD's Avatar
King Spam Talker

Posts: 1,296
Trades: 0
This code works well

RewriteEngine On
RedirectMatch 301 /directory/contact-us/ http://www.google.com/
RedirectMatch 301 /directory/company/ http://www.yahoo.com/

but lets say I want to replace those with a wildcard that
sends any page OTHER than the homepage http://www.bing.com/

Basically I want to do something like this:
RedirectMatch 301 /directory/*/ http://www.bing.com/

What is the correct regular expression for this type of 301 command?
__________________

Please login or register to view this content. Registration is FREE
"Order a PEBBLE Smart Watch for Bluetooth connection to your iPhone or Android" - 100% Waterproof - 7+ days Battery Charge - High Res Outdoor Readable - Vibrating Alert - Incoming Caller ID
TWD is online now
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-23-2012, 08:57 AM Re: How to add a wildcard in RedirectMatch 301
chrishirst's Avatar
Defies a Status

Posts: 43,963
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Code:
path/.*$
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-23-2012, 09:09 AM Re: How to add a wildcard in RedirectMatch 301
chrishirst's Avatar
Defies a Status

Posts: 43,963
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Okay maybe I should explain that.

. (fullstop/period/dot) matches any character except line breaks

* indicates one or more matches

$ means "to end of string"
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-23-2012, 09:09 AM Re: How to add a wildcard in RedirectMatch 301
TWD
TWD's Avatar
King Spam Talker

Posts: 1,296
Trades: 0
Quote:
Originally Posted by chrishirst View Post
Code:
path/.*$
Regex makes my brain cry.

What do the "." the "*" and the "$" each mean?

If I may be so bold?
__________________

Please login or register to view this content. Registration is FREE
"Order a PEBBLE Smart Watch for Bluetooth connection to your iPhone or Android" - 100% Waterproof - 7+ days Battery Charge - High Res Outdoor Readable - Vibrating Alert - Incoming Caller ID
TWD is online now
Reply With Quote
View Public Profile
 
Old 07-23-2012, 09:19 AM Re: How to add a wildcard in RedirectMatch 301
chrishirst's Avatar
Defies a Status

Posts: 43,963
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
Originally Posted by TWD View Post
Regex makes my brain cry.

What do the "." the "*" and the "$" each mean?

If I may be so bold?
See the pre-emptive strike
Quote:
Originally Posted by chrishirst View Post
Okay maybe I should explain that.
Yeah I know, nobody loves a smartarse!!
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-23-2012, 11:12 AM Re: How to add a wildcard in RedirectMatch 301
TWD
TWD's Avatar
King Spam Talker

Posts: 1,296
Trades: 0
Thank you sir.

It's all freakin Egyptian Hieroglyphics to me.
__________________

Please login or register to view this content. Registration is FREE
"Order a PEBBLE Smart Watch for Bluetooth connection to your iPhone or Android" - 100% Waterproof - 7+ days Battery Charge - High Res Outdoor Readable - Vibrating Alert - Incoming Caller ID
TWD is online now
Reply With Quote
View Public Profile
 
Reply     « Reply to How to add a wildcard in RedirectMatch 301
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.32400 seconds with 11 queries