Deployment to Production htaccess issues
  • Hi,

    I tried pushing the fuel repo to the client server and I am able to access only the home page of the application i.e., the main url of the application apart from it none of the internal URLs are accessible and gives 404.

    Here is my htaccess code, re-write is enabled on the apache2 server. The code is deployed on /var/www/html folder using the default host created by apache.


    Options +FollowSymLinks


    RewriteEngine On
    RewriteBase /


    Order Deny,Allow
    Deny From All


    # Allow asset folders through
    RewriteRule ^(fuel/modules/(.+)?/assets/(.+)) - [L]

    # Protect application and system files from being viewed
    RewriteRule ^(fuel/install/.+|fuel/crons/.+|fuel/data_backup/.+|fuel/codeigniter/.+|fuel/modules/.+|fuel/application/.+) - [F,L]


    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule .* index.php?/$0 [L]
    #RewriteRule ^(.*)$ /index.php/$1 [L] # tried some variations here, but couldnt get through

    # Prevents access to dot files (.git, .htaccess) - security.
    RewriteCond %{SCRIPT_FILENAME} -d
    RewriteCond %{SCRIPT_FILENAME} -f
    RewriteRule "(^|/)\." - [F]


    Options -Indexes


    Here is the apache config, the very basic one.


    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    #ServerName www.example.com

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf


  • Thank you very much admin, I guess the virtual host was not configured properly.
    I made the below changes to the virtual host, referring the link:

    https://www.digitalocean.com/community/questions/how-to-set-the-default-virtual-host-on-apache-2

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!