Welcome Guest, Not a member yet? Register   Sign In
.htaccess makes 403
#1

Dear all.
I'm new to Codeigniter, and unfortunately i'm new in .htaccess. I have a sample CI script that i want to learn.
Everytime i open this CI script always get 403 forbidden, buat when i delete the .htaccess it loads normally.
I'm sure there must be a problem with .htaccess.
----
I install this script in an addon domain that point to folder /public_html/newdomain.com
Yes, i installed it in subfolder, not in the main folder.
[Image: addon-domain.png]
and here is my .htaccess
Code:
# Disable directory browsing
Options All -Indexes

# ----------------------------------------------------------------------
# Rewrite engine
# ----------------------------------------------------------------------

# Turning on the rewrite engine is necessary for the following rules and features.
# FollowSymLinks must be enabled for this to work.
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On

# If you installed CodeIgniter in a subfolder, you will need to
# change the following line to match the subfolder you need.
# http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase
# RewriteBase /

# Redirect Trailing Slashes...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Checks to see if the user is attempting to access a valid file,
    # such as an image or css document, if this isnt true it sends the
    # request to the front controller, index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\s\S]*)$ index.php/$1 [L,NC,QSA]

# Ensure Authorization header is passed along
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we dont have mod_rewrite installed, all 404
    # can be sent to index.php, and everything works as normal.
    ErrorDocument 404 index.php
</IfModule>

# Disable server signature start
ServerSignature Off
# Disable server signature end
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
<IfModule mod_headers.c>
    Header set Cache-Control "no-cache, no-store, must-revalidate"
    Header set Pragma "no-cache"
    Header set Expires 0
</IfModule>

<FilesMatch "\.(css|flv|gif|htm|html|ico|jpe|jpeg|jpg|js|mp3|mp4|png|pdf|swf|txt)$">
    <IfModule mod_expires.c>
        ExpiresActive Off
    </IfModule>
    <IfModule mod_headers.c>
        FileETag None
        Header unset ETag
        Header unset Pragma
        Header unset Cache-Control
        Header unset Last-Modified
        Header set Pragma "no-cache"
        Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
        Header set Expires "jue, 1 Jan 1970 00:00:00 GMT"
    </IfModule>
</FilesMatch>

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php74” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php74___lsphp .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

I'm sure the error is in this .htaccess, unfortunately i'm begiiner in apache directives. Hopefully somebody help me. Thanks.
This scripts works perfect if i install it in main public_html. But i get 403 when i installed it in subfolder above. 
Thanks.
Reply
#2

(This post was last modified: 01-21-2024, 06:49 PM by okiewardoyo.)

commeting this below line make it works.
Code:
AddHandler application/x-httpd-ea-php74___lsphp .php .php7 .phtml solve the problem
#AddHandler application/x-httpd-ea-php74___lsphp .php .php7 .phtml
Reply




Theme © iAndrew 2016 - Forum software by © MyBB