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
RedirectMatch v RewriteRule - What is best practice?
Old 07-24-2012, 12:46 AM RedirectMatch v RewriteRule - What is best practice?
TWD
TWD's Avatar
King Spam Talker

Posts: 1,296
Trades: 0
I am getting dirty with .htaccess this week because I have two clients who are moving sites.

Basic question:
What is the difference between these two statements and is one considered preferable to the other?

Code:
RewriteEngine On
RedirectMatch 301 foo bar
Code:
RewriteEngine on
RewriteRule foo bar [R=301,L]
__________________

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 offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-27-2012, 09:45 PM Re: RedirectMatch v RewriteRule - What is best practice?
TWD
TWD's Avatar
King Spam Talker

Posts: 1,296
Trades: 0
anyone
__________________

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 offline
Reply With Quote
View Public Profile
 
Old 07-28-2012, 07:24 AM Re: RedirectMatch v RewriteRule - What is best practice?
chrishirst's Avatar
Defies a Status

Posts: 43,949
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
The simple answer is they use different modules.

RedirectMatch uses mod_alias, RewriteRule uses mod_rewrite.


The longer answers is:

RedirectMatch (mod_alias) is a relatively simple method of 'redirecting', that creates an "alias" for the actual document location. Think of it as being similar to a Unix SymLink or a Windows shortcut, where, when you click "My Documents" it actually opens drive:\users\username\documents\


RewriteRule (mod_rewrite) is much more flexible system and therefore more complex and I'm not even going to try and explain how it works in a forum post.
I'll leave that to Neil Crosby. >> http://www.workingwith.me.uk/article...ng/mod_rewrite
__________________
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-28-2012, 09:32 AM Re: RedirectMatch v RewriteRule - What is best practice?
TWD
TWD's Avatar
King Spam Talker

Posts: 1,296
Trades: 0
OK. Thank you. That explains what the difference is.

But is one considered BEST PRACTICE vs the other?
Is it 6 of one and half dozen of the other?

Are there any SEO benefits of one vs the other? (I dont imagine so).
__________________

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 offline
Reply With Quote
View Public Profile
 
Old 07-28-2012, 06:37 PM Re: RedirectMatch v RewriteRule - What is best practice?
chrishirst's Avatar
Defies a Status

Posts: 43,949
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Best practice is to use the one that meets the requirements of what you need to do. A fairly simple A >> B probably only needs a RedirectMatch, if the URLs have two or more parameters rewrite rules are needed.

Quote:
Are there any SEO benefits of one vs the other? (I dont imagine so).
Absolutely none whatsoever.

You do need to be aware that .htaccess rules are read and applied from top to bottom AND that that any HTTP request may or will load the .htaccess twice because a redirect/rewrite event creates an second, internal request for the new URL. So ensure that there are no conflicts that could attempt to rewrite or redirect an already rewritten URL.
__________________
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-29-2012, 12:00 AM Re: RedirectMatch v RewriteRule - What is best practice?
TWD
TWD's Avatar
King Spam Talker

Posts: 1,296
Trades: 0
Quote:
Originally Posted by chrishirst View Post
So ensure that there are no conflicts that could attempt to rewrite or redirect an already rewritten URL.
hmm. Good point. thanks for that.
__________________

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 offline
Reply With Quote
View Public Profile
 
Reply     « Reply to RedirectMatch v RewriteRule - What is best practice?
 

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.20677 seconds with 11 queries