Welcome Guest, Not a member yet? Register   Sign In
Rewrite + Authentication
#1

[eluser]JanDoToDo[/eluser]
Hey guys

When I put some basic authentication on one of my folders my site stops working. Could anyone explain this/ help!?

.htaccess next to system, application and index.php
RewriteEngine on
RewriteBase /
#RewriteCond $1 !^(index\.php|index\.html|assets|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)? index.php?/$1 [L]

And I have a folder which would be /assets/scripts/payment/ that I need to have basic authentication on. When I put this htaccess inside the payment directory, it errors and says "page cannot be found" as thoguht it isnt rewriting the url anymore

AuthName "Admin section"
AuthUserFile "/home/studentc/.htpasswds/public_html/assets/scripts/payment/passwd"
AuthType Basic
require valid-user

Why would adding authentication stop this page from working?

Cheers for any help !!!
#2

[eluser]JanDoToDo[/eluser]
Anyone any ideas? Smile
#3

[eluser]JanDoToDo[/eluser]
Anyone know why putting authentication in would stop the rewrite process???
#4

[eluser]bretticus[/eluser]
What is the version of Apache on the server where this is hosted? I think there may be a bug in apache 1.x.
#5

[eluser]JanDoToDo[/eluser]
Apache version is 2.0.63!
#6

[eluser]bretticus[/eluser]
Another thing you can try is to explicitly avoid this folder (which you'd think the -f / -d would do) in your man .htaccess file:

Code:
RewriteRule ^assets - [L]

Run that before:

Code:
RewriteRule ^(.*)? index.php?/$1 [L]

Also, you can try to turn off mod rewrite in the .htaccess rule that has the authentication config.
#7

[eluser]JanDoToDo[/eluser]
Bretticus - That worked perfectly. Thankyou!!!!!!
#8

[eluser]JanDoToDo[/eluser]
Oh... nope. Now that alows me to get to that page, but when I go to the rest of the site I get a 500 internal server error?!
#9

[eluser]bretticus[/eluser]
[quote author="JanDoToDo" date="1274131730"]Oh... nope. Now that alows me to get to that page, but when I go to the rest of the site I get a 500 internal server error?![/quote]

What do your .htaccess files look like right now?
#10

[eluser]JanDoToDo[/eluser]
Is the main one, and the same auth lines in the payment directory
The script is in /payment/payment_result.php

Code:
RewriteEngine on

RewriteBase /

RewriteCond $1 !^(index\.php|index\.html|assets|payment|robots\.txt)
RewriteRule ^payment - [L]
RewriteRule ^(.*)$ /index.php/$1 [L]




Theme © iAndrew 2016 - Forum software by © MyBB