Solved

htaccess file tweak. Help needed to give access to a application

Posted on 2006-11-18
14
193 Views
Last Modified: 2010-04-11
Hi experts

I cannot access a file / application due to the .htaccess restricting access. I get the following error. it redirects to my 404 error page.

when i disable the the .htaccess by making it a text file the application works. My question is what do i add to the .htaccess file to get the application to work.

here is the current .htaccess file settings
*******************************************
Options +FollowSymlinks
RewriteEngine On
RewriteRule   ^manage(.*)$      -      [L]
RewriteRule   ^batch(.*)$      -      [L]
RewriteRule   ^export(.*)$      -      [L]
RewriteRule   ^templates(.*)$      -      [L]
RewriteRule   ^favicon\.ico(.*)$      -      [L]
RewriteRule      ^robots\.txt$ - [L]
RewriteRule      ^plain\.php$ - [L]
RewriteRule      ^(.*)$      index.php      [L]

*******************************************
i need to access all the files with in the following 'CB' folder on my server: /public_html/cb/

Thanks experts.

mdc

0
Comment
Question by:matthewdacruz
  • 5
  • 4
  • 4
14 Comments
 
LVL 14

Assisted Solution

by:yessirnosir
yessirnosir earned 250 total points
ID: 17973971
I'm no expert on this, having only done this a few times under duress!  But in my case I had to add a RewriteBase directive to match up my server's physical file paths with the URL, i.e. the   "public_html" folder is what I see on my server, but it becomes the root directory to external clients, so I needed to add this line:
RewriteBase /
right after "rewriteEngine On" to tell the server essentially that the public_html directory is the root directory.  Without the RewriteBase / command, I got 404 errors too.

0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 250 total points
ID: 17975671
>  i need to access all the files with in the following 'CB' folder on my server: /public_html/cb/
add follwoing after RewriteEngine line:

RewriteCond %{REQUEST_URI}  !^[/]*cb/
0
 

Author Comment

by:matthewdacruz
ID: 17975708
Thanks Dude!

That fixed the problem...


MDC
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 51

Expert Comment

by:ahoffmann
ID: 17976161
if you add
   RewriteBase /
then /cb is still a directory there, which is never reached with above rules.
Could you please explain how that works now.
0
 

Author Comment

by:matthewdacruz
ID: 17977889
Hi Hoffman

I had not seen your comment when i had responded and awarded the points to yessirnosir .
here is what i had done.

RewriteEngine On
RewriteBase /
RewriteRule   ^cb(.*)$      -      [L]

This allowed my application to run. Please excuse me if i was wrong and could you let me know if I am wrong. To be honest this is the first time i have worked with an .htaccess file. I am not familiar with the rules. I just copied what was working and modified it.

It seemed to do the trick but i have no idea of the conciquences.

Thanks


MDC
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 17978175
aha, so your own added rule ^cb(.*) fixed the problem, not the RewriteBase
0
 

Author Comment

by:matthewdacruz
ID: 17978192
Ye thats what i did
what is the RewriteBase do?

MDC
0
 
LVL 14

Expert Comment

by:yessirnosir
ID: 17992850
It would be interesting to test what happens without the rewritebase command.  When I saw the original post, I figured that if the problem had only been the missing "cb" redirect, then any request for something in the cb directory would have been redirected by the original .htaccess to index.php.  The fact that it gave a 404 error suggested to me that the bigger problem was the lack of a rewritebase command.   But I agree with ahoffman that it needed the cb rule too, so certainly if you wanted to ask moderators to re-allocate points (can they do that?) that would be fair.
0
 

Author Comment

by:matthewdacruz
ID: 17994259
Where would i do that, to re allocate points

thanks

mdc
0
 
LVL 14

Expert Comment

by:yessirnosir
ID: 17995549
I think you would post a question over in "community support".    It looks like you can ask for a question to be re-opened, and that would allow you to change points splits.

http://www.experts-exchange.com/Community_Support/
0
 

Author Comment

by:matthewdacruz
ID: 17996468
Hi Guys

I have allocated the point to bioth of you and split it down the middle. I hope you have both recieved the credits. Thanks for the help

MDC
0
 
LVL 14

Expert Comment

by:yessirnosir
ID: 17996553
Thanks.  
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 17996710
Thanks.
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question