LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 05-12-2009, 04:48 AM   #1
David4321
LQ Newbie
 
Registered: May 2009
Posts: 3

Rep: Reputation: 0
basic htaccess question


I am a webmaster and advanced user, but not much of a scripter.

I have a folder in the root called "special". Occasionally, when I run special prices, I place a revised index in that folder (with the special prices on it), and send out emails with a clickable link to the discount page. Now, when the special sale is over, I'd like to redirect all requests for that folder (ie: links or requests for www.mydomain.com/special, as well as links or requests for www.mydomain.com/special/index-xyz123.html ) to the root (ie: www.mydomain.com) Note: the root of this website is not the true root of my hosting - it's a subfolder.

a) which folder should the htaccess be in? (hosting root, website root, or "special" subfolder)

b) what should the content be?

I've tried 301 & other approaches, and placed the file in the root and the special folder. Not sure what I'm doing wrong, I can't seem to get a correct result. Godaddy assures me I am on the right server and there are no permission problems.

Thanks

Last edited by David4321; 05-12-2009 at 05:21 AM.
 
Old 05-12-2009, 05:00 AM   #2
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
The .htaccess file should go into the special folder. It's content should be something like
Code:
Redirect /special_folder_name http://my_domain.com/start_folder
check out
http://httpd.apache.org/docs/2.2/mod....html#redirect

Also make sure that your webservers allows usage of .htaccess files. The AllowOverride directive takes care of this and should not be set to None. (I'd go with All just to make sure the file is read)
Beside you can also put all the stuff that you put into a .htacces file inside the webserver config. Makes for faster queries cause the filesystem does not need to be searched for .htacces files.

Regards Zhjim
 
Old 05-12-2009, 05:45 AM   #3
David4321
LQ Newbie
 
Registered: May 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Resolved

Thanks that's it:


Redirect 301 /special http://www.mydomain.com

Redirect 301 /special/purchase.html http://www.mydomain.com/purchase.html
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
.htaccess AuthType Basic - allowing free access to specific file? ivanatora Linux - Software 0 11-21-2007 02:28 AM
Issues with htaccess (basic authentication) Jake_B Linux - Server 4 04-22-2007 12:25 PM
.htaccess with Basic authentication throws MySQL error in Error Log shailesh_mishra Linux - Security 6 01-17-2007 10:15 AM
Basic authentication with .htaccess throws MySQL error in Error Log shailesh_mishra Linux - Networking 2 01-12-2007 01:16 PM
apache .htaccess basic authentication not working quite right kleptophobiac Linux - Software 3 01-10-2004 02:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration