LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-18-2009, 02:29 PM   #1
vaibhavs
Member
 
Registered: Jun 2008
Posts: 113

Rep: Reputation: 15
need help with .htaccess pls


Hi,

I have a sub-folder called "blog" http://www.domain.com/blog/

In the "blog", folder I have created a .htaccess as follows:
Code:
RewriteEngine on
RewriteRule ^(.*)$ "http\:\/\/www\.domain\.com" [R=301,L]

But if I try to access http://www.domain.com/blog/aaa.php, I get a 404 error and the 404.shtml is displayed.

What I need is a redirection if any file under /blog/ is accessed.

Pls advice what am I doing wrong ??

Or is it that 404.shtml is getting higher presidence over .htaccess

Thx in advance.

Regards,
Vai
 
Old 06-18-2009, 03:09 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,220
Blog Entries: 1

Rep: Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074
The 404 error means that you get redirected to a non existent URL, so take a look at your apache error_log to see where that rule takes you.
Other than the fact that this rule will never let you access /blog, it should work.
 
Old 06-18-2009, 03:16 PM   #3
vaibhavs
Member
 
Registered: Jun 2008
Posts: 113

Original Poster
Rep: Reputation: 15
The error logs shows this:

Quote:
[Thu Jun 18 15:14:11 2009] [error] [client 122.169.38.34] File does not exist: /home/domain/public_html/blog, referer: http://www.domain.com/blog/contact.php
[Thu Jun 18 15:14:13 2009] [error] [client 122.169.38.34] File does not exist: /home/domain/public_html/blog
Why is apache saying "/home/domain/public_html/blog" does not exist ?
The folder /blog does exist!

Pls help me here.....
This seems to be beyond my understanding.

Thx
Vai
 
Old 06-18-2009, 03:19 PM   #4
vaibhavs
Member
 
Registered: Jun 2008
Posts: 113

Original Poster
Rep: Reputation: 15
And yes, "contact.php" does not exists under /blog/

And yes, I do not wish /blog to be accessed.
All requests for any file under /blog/ should go to the http://www.domain.com

Thx
Vai
 
Old 06-18-2009, 03:30 PM   #5
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,220
Blog Entries: 1

Rep: Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074
Quote:
Why is apache saying "/home/domain/public_html/blog" does not exist ?
The folder /blog does exist!
What is your DocumentRoot
Does /home/domain/public_html/blog exist?
 
Old 06-18-2009, 03:36 PM   #6
vaibhavs
Member
 
Registered: Jun 2008
Posts: 113

Original Poster
Rep: Reputation: 15
My bad!!!!
I was actually access the wrong url.

When I accessed the correct url, the .htaccess is working fine!!

Thx for the help!!
Really appreciate it.

Best regards,
Vai
 
  


Reply


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't play .pls files in Rhythmbox, closes when I try to load .pls file lqv Linux - Software 2 01-07-2013 09:30 AM
RHEL 3 with Windows XP - Help please pls pls ar_m_in Red Hat 7 10-01-2006 10:42 AM
pls pls pls help me ! i'm tired with httpd config on fedora apache 2.0.48 AngelOfTheDamn Fedora 0 01-24-2004 06:12 PM
.htaccess tailine Linux - Newbie 27 06-16-2003 08:27 AM
Htaccess DoobyWho Linux - General 4 04-28-2003 02:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:15 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