1

I was trying to remove the index.php from the URL, on my WAMP server THIS worked perfectly, but for some reason on my actual hosted server it's not.

I just created on my current Linux Ubuntu Server a sub-domain, under /var/www/tools.example.com/public_html

I checked if mod_rewrite is enabled using a .php file I uploaded to the dir with this:

<?php 
phpinfo();

and mod_rewrite is under "Loaded Modules". so no worries here.

the .conf file I created in etc/apache2/sites-available/tools.example.com.conf looks like this:

<VirtualHost *:80>
    ServerName tools.example.com
    ServerAdmin [email protected]

    ErrorLog /var/www/tools.example.com/logs/error.log
    CustomLog /var/www/tools.example.com/logs/access.log combined
    DocumentRoot /var/www/tools.example.com/public_html

    <Directory /var/www/tools.example.com.conf/public_html/>
            Options Indexes FollowSymLinks MultiViews
            # changed from None to FileInfo
            AllowOverride All
            Order allow,deny
            allow from all
    </Directory>

</VirtualHost>

where AllowOverride All so using mod_rewrite with .htaccess is enabled.

I don't know why this is still not working. Any idea why?

the content of the .htaccess file in the main dir:

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

Edit #1:

I already went through all first 9 solutions in this post: CodeIgniter removing index.php from url

4
  • Possible duplicate of CodeIgniter removing index.php from url Commented Oct 28, 2015 at 16:34
  • Would help to provide your .htaccess. Commented Oct 28, 2015 at 16:34
  • re-read I was trying to remove the index.php from the URL, on my WAMP server this worked perfectly, "this" has a link in it. Commented Oct 28, 2015 at 16:35
  • I updated my post with the .htaccess file content to be more clear. Commented Oct 28, 2015 at 16:36

1 Answer 1

1

Your path is incorrect in your .conf file for the directory directive. Your document root listed should be the same as your Directory directive. So I don't think it's picking up the AllowOverride All directive.

Change this

<Directory /var/www/tools.example.com.conf/public_html/>

To this

<Directory /var/www/tools.example.com/public_html/>
Sign up to request clarification or add additional context in comments.

Comments

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.