1

I have a website like this (sub-domain)

rabbani.websolocom.xyz

And I have the .htaccess code like this (I used Codeigniter) :

RewriteEngine on
RewriteBase /rabbani
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-D
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

But when I try to access my website it goes error (500 Internal Server Error). What should i do with my .htaccess file? Or any another file that wrong in my directory?

5 Answers 5

3

Use this

.htaccess(Outside application folder)

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

This is Codeigniter recommended .htaccess

Sign up to request clarification or add additional context in comments.

Comments

1

Place the .htaccess inside the rabbani folder Like This

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !\.[^./]+$
RewriteCond %{REQUEST_URI} !(.*)/$

Comments

0

Try these two htaccess

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /public_html/index.php/$1 [L,QSA]

And

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(.*)\.domain\.com
RewriteRule ^(.*)$ http://domain.com/%1/$1 [L,NC,QSA]

More htaccess here.

Comments

0

This is my new .htaccess

<IfModule mod_rewrite.c>
    RewriteEngine On
    # !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading
    #  slashes.
    # If your page resides at
    #  http://www.example.com/mypage/test1
    # then use
    # RewriteBase /mypage/test1/
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

Comments

-1

Try this: if you are using codeigniter on local system

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /projectfolder/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /projectfolder/index.php/$1 [L]
</IfModule>

If you are using it on server then use this:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

1 Comment

Thanks for all of your answers sir :) but when i asked who has the hosting, he immediatly fixed my error. Changed my htaccess into his htaccess. I'll paste my new htaccess later

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.