WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-02-2008, 10:57 PM
freehits's Avatar
freehits freehits is offline
WebProWorld Veteran
 

Join Date: Sep 2004
Location: Posse's On Broadway
Posts: 953
freehits RepRank 0
Default htaccess redirect

I know anytime htaccess is in the question the thing never gets answered and goes to the bottom with 0 replies ;P

Just hard to find a resource for all questions.

I use this

RewriteEngine On
RewriteRule ^profile.html$ MYLINKHERE.com/page.html[L,R=301]

This is fine but changes the URl of course.
The ladning page url shows in the browser.

I have seen redirects that keeps the original url in the browser, how is this accomplished?

I know affiliates love this....
Reply With Quote
  #2 (permalink)  
Old 03-03-2008, 08:29 AM
mikesmith76 mikesmith76 is offline
WebProWorld Pro
 

Join Date: Sep 2005
Location: Manchester, UK
Posts: 253
mikesmith76 RepRank 0
Default Re: htaccess redirect

Quote:
RewriteEngine On
RewriteRule ^profile.html$ MYLINKHERE.com/page.html[L,R=301]
This rule causes a redirect header to be outputted, you've told it do do this by adding R=301 to the parameters at the end.

If you was to use

Quote:
RewriteEngine On
RewriteRule ^profile.html$ MYLINKHERE.com/page.html[L]
this would silently rewrite the link as opposed to using an external redirect.

Don't forget to flush your browsers cache when testing.
Reply With Quote
  #3 (permalink)  
Old 03-03-2008, 09:52 AM
wige's Avatar
wige wige is offline
Moderator
WebProWorld Moderator
 

Join Date: Jun 2006
Location: United States
Posts: 1,629
wige RepRank 4wige RepRank 4wige RepRank 4
Default Re: htaccess redirect

You have to remove the domain name when doing an internal redirect. For example:

User URL: yoursite.com/products/my-great-product.html
URL of the script: yoursite.com/showproduct.php?name=my-great-product
Redirect Rule: RewriteRule ^/products/(.*).html$ /showproduct.php?name=$1 [L]

Otherwise, if you include the domain name in the redirect rule, the server will assume you want to redirect the user to an external site and will use a 302 redirect.
__________________
The best way to learn anything, is to question everything.
Interestingly Average Security Blog
Reply With Quote
  #4 (permalink)  
Old 03-03-2008, 04:53 PM
mikesmith76 mikesmith76 is offline
WebProWorld Pro
 

Join Date: Sep 2005
Location: Manchester, UK
Posts: 253
mikesmith76 RepRank 0
Default Re: htaccess redirect

Quote:
You have to remove the domain name when doing an internal redirect.
Glad somebody remembered that part. Thanks!
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum


Thread Tools
Display Modes

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
301 Redirect and htaccess problem thindenim Web Programming Discussion Forum 5 03-13-2007 10:55 PM
htaccess + redirect newconceptdesign Search Engine Optimization Forum 5 02-14-2007 06:39 PM
.htaccess redirect issue rkstevens Search Engine Optimization Forum 1 01-14-2007 11:11 AM
.htaccess for 301 redirect ? TransferTown Other Engines/Directories 8 01-06-2007 01:26 AM
Please help - 301 redirect a directory .htaccess African-Safari Search Engine Optimization Forum 1 10-05-2005 10:46 AM


Search Engine Friendly URLs by vBSEO 3.0.0