Web Server Configuration
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsWeb DesignWeb Server Configuration

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old May 18th, 2006, 05:43 AM
SnapCracker's Avatar
SnapCracker SnapCracker is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: Kent, United Kingdom
Posts: 165 SnapCracker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 21 h 22 m 31 sec
Reputation Power: 4
Using .htaccess file to redirect user to webpage

Hi, I would like to know what code to use in htaccess file in order to redirect a user who types in say www.mycompany.com/fundraising and then instantly directs them to a webpage that actually exists like http://www.mycompany.com/somethings...s/lastthing.htm. This is so the user does not have to type that long string in order to get to the view the page. This is used alot by companies to promote special offers etc.

Would it be on the lines of:
RedirectMatch ^/fundraising http://www.mycompany.com/somethings...s/lastthing.htm

in the htaccess file, but where? does it matter?

I have used a meta refresh for that purpose, like this;
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=http://www.mycompany.com/somethings/someotherthings/lastthing.htm"> <META NAME="GENERATOR" CONTENT="Mozilla/3.0Gold (Win95; I) [Netscape]"> and I have just called it a name without the extension name like 'fundraising'
However, it's very slow and the user knows they are being redirected. I need something a bit more smooth and professional.

Reply With Quote
  #2  
Old May 18th, 2006, 10:28 PM
infamous-online infamous-online is offline
Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 404 infamous-online User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 24 m 44 sec
Reputation Power: 7
simple like this

redirect /example/ http://www.mycompany.com/fundraising.html

nto hard at all . as soon as the example link is parsed, it then looks at the htaccess file, and redirects the link to the fundraising.html file.

try it out, and see if this helps you solve your problem.
__________________
Apache Expert

Reply With Quote
  #3  
Old May 22nd, 2006, 06:48 AM
SnapCracker's Avatar
SnapCracker SnapCracker is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: Kent, United Kingdom
Posts: 165 SnapCracker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 21 h 22 m 31 sec
Reputation Power: 4
Quote:
Originally Posted by asp_man
simple like this

redirect /example/ http://www.mycompany.com/fundraising.html

nto hard at all


Thanks asp! What appeared to be as simple as copying a file in DOS, turned out to be the most frustrating and puzzling time I have ever had! Can I just point out that I was trying redirect to url FROM /fundraising TO a complicated path but I could see your point. My website is hosted on a shared server by 1&1. They have FAQ which has examples of code that actually encourages you change your .htaccess file in order to manipulate the url. At first I used the RewriteEngine On
RewriteRule ^test.html /test.php and uploaded to my website using dreamweaver (which has built the whole site) as a simple test to see if I was able to make changes to the .htaccess that worked, here I created 2 files so typing in /test.html would redirect to /test.php. After a while convinced that it was the server, I called 1&1 who edited my .htaccess file for me to exclude this line of code:-
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
and then suddenly it worked in my IE browser. Fine, I could go ahead and make changes myself knowing that this syntax was good. No! whatever I did not not make any difference, and in fact deleting the file made no difference on my IE browser! I then used Safari and the redirect did not work, nor did it work on any other machine I have on any type of browser. Restoring the original working file did change anything either, only the original IE browser (even after restarting) kept being faithfully re-directing the test. I called them again and a different person suggested that changes made to that file could take hours to take affect. The next morning, no change, called 1&1, convinced him that something weired going on, he created a new .htaccess himself, inserted my code and it worked! I asked him to change it to what I really wanted which was if /fundraising was added to the end of my domain name it would redirect to it to a unfriendly path, he used that and it did not seem to would and we put it down to that a file called fundraising needs to exist, even though I think it should not care. In the end, he put his own code in using another command (which is not too dissimilar to yours) as follows:-

redirect permanent /fundraising http://mydomain.co.uk/0cashbackshops/CashbackshopsIF.php

and it works. it appears that RewriteEngine On
RewriteRule ^fundraising /0cashbackshops/CashbackshopsIF.php [R] does not work

So it appears that I have had multiple problems that compounded the resolution, that worst of all not being able to make changes myself even though they do get uploaded (I know this because the 1&1 staff have used the code). A browser with a memory which displays historical events. Even though it works now I am still confused as to why I should get so many problems, could you please suggest anything I could do to help me?

Reply With Quote
  #4  
Old May 23rd, 2006, 07:10 PM
infamous-online infamous-online is offline
Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 404 infamous-online User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 24 m 44 sec
Reputation Power: 7
ok explain to me exactly what the issue is, so i can better assist you. i read your response but i would like to know, what all do you have in your .htaccess file? if you could post an example of the stuff you have in your htaccess file.

also are the you trying to redirect this from a server not on your main host?

Reply With Quote
  #5  
Old May 24th, 2006, 03:41 AM
SnapCracker's Avatar
SnapCracker SnapCracker is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: Kent, United Kingdom
Posts: 165 SnapCracker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 21 h 22 m 31 sec
Reputation Power: 4
Hi asp! The issue after my long explaination is that it now works and does what it's meant to, but I have to get 1&1 to edit the file for me. For that reason, it's not really an issue about what goes in the file but how the file is edited.

Reply With Quote
  #6  
Old May 24th, 2006, 04:56 AM
infamous-online infamous-online is offline
Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 404 infamous-online User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 24 m 44 sec
Reputation Power: 7
hmmm you can't ftp to your main directory under ascii? i mean i think that's a bit much, when you can't edit the file yourself, cause that's a lot of time wasted waiting on them to fix the setting for you.

Reply With Quote
  #7  
Old June 21st, 2006, 08:52 AM
SnapCracker's Avatar
SnapCracker SnapCracker is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: Kent, United Kingdom
Posts: 165 SnapCracker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 21 h 22 m 31 sec
Reputation Power: 4
I know it's been a while but it's one of things I put on the back burner! ....and recently after discussing issues on other topics, I suspect it could be the fault of my dreamweaver text editor not giving me the truth such as text editors do. Therefore I'm ftp'in up garbage and as far as I'm aware it's good. I have a case about 2 years ago, where I cut and pasted a whole bunch of php code into dreamweaver's editor and it wouldn't work. Explaining my problem of this forum I pasted the code onto this box and submitted the post. Upon viewing the post after submitting, the php code between the code tags it showed up all sorts of erroneous characters not seen in the dreamweaver text editor.
Therefore a good text editor and a separate ftp client should sort things out.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsWeb DesignWeb Server Configuration > Using .htaccess file to redirect user to webpage


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway