• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
.htaccess woes

#1
Hi guys,

I'm just perfecting the install process of ignitedCMS with the help of bonfire veterans like mwhitney, but this has bugged me from the get go. Well perhaps, I'm making a simple mistake. Huh

I've not added a .htaccess file to clean the urls to remove index.php as I've never found a solution that works on all environments.
For example, my linux box uses a different .htaccess to my server which is also running linux but a different flavour with plesk -> maybe plesk is doing something else with .htaccess files I don't know of.

Additionally, it seems windows and mac have ever so slightly subtle difference with the .htaccess files.

I'm just wondering if I'm doing something wrong. Is there a STANDARD .htaccess file that is guaranteed to work on all environments.

Otherwise I'll just have to make do without them as they cause more headaches.

My manifesto is simple, a one-click install with no manual configuration where-ever possible. The .htaccess prevents me from making this possible although I'd love to clean up my urls.
Practical guide to IgnitedCMS - Book coming soon
Reply

#2
(07-25-2015, 03:19 AM)iamthwee Wrote: Hi guys,

I'm just perfecting the install process of ignitedCMS with the help of bonfire veterans like mwhitney, but this has bugged me from the get go. Well perhaps, I'm making a simple mistake.  Huh

I've not added a .htaccess file to clean the urls to remove index.php as I've never found a solution that works on all environments.
For example, my linux box uses a different .htaccess to my server which is also running linux but a different flavour with plesk -> maybe plesk is doing something else with .htaccess files I don't know of.

Additionally, it seems windows and mac have ever so slightly subtle difference with the .htaccess files.

I'm just wondering if I'm doing something wrong. Is there a STANDARD .htaccess file that is guaranteed to work on all environments.

Otherwise I'll just have to make do without them as they cause more headaches.

My manifesto is simple, a one-click install with no manual configuration where-ever possible. The .htaccess prevents me from making this possible although I'd love to clean up my urls.


Try using the Htaccess provided by Laravel?
Reply

#3
Thanks, I will try the Laravel .htaccess file on my Mamp, lamp and wamp stacks and let you know if they all worked?
Practical guide to IgnitedCMS - Book coming soon
Reply

#4
Try using this one from FuelPHP:

Code:
<IfModule mod_rewrite.c>

   # Make sure directory listing is disabled
    Options +FollowSymLinks -Indexes
    RewriteEngine on

    # NOTICE: If you get a 404 play with combinations of the following commented out lines
    #AllowOverride All
    #RewriteBase /wherever/ci/is
    RewriteBase /

    # Restrict your site to only one domain
    # Important USE ONLY ONE OF THESE OPTIONS BELOW!

    # Option 1: To rewrite "www.domain.com -> domain.com" uncomment the following lines.
    #RewriteCond %{HTTPS} !=on
    #RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    #RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

    # Option 2: To rewrite "domain.com -> www.domain.com" uncomment the following lines.
    #RewriteCond %{HTTPS} !=on
    #RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
    #RewriteCond %{HTTP_HOST} (.+)$ [NC]
    #RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]

    # Option 3: Remove index.php from URL
    #RewriteCond %{HTTP:X-Requested-With}    !^XMLHttpRequest$
    #RewriteCond %{THE_REQUEST}                ^[^/]*/index\.php [NC]
    #RewriteRule ^index\.php(.*)$            $1 [R=301,NS,L]

    # Send request via index.php (again, not if its a real file or folder)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteCond $1 ^(robots\.txt|favicon\.ico|style\.css)

    # deal with php5-cgi first
    <IfModule mod_fcgid.c>
        RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
    </IfModule>

    <IfModule !mod_fcgid.c>

        # for normal Apache installations
        <IfModule mod_php5.c>
            RewriteRule ^(.*)$ index.php/$1 [QSA,L]
        </IfModule>

        # for Apache FCGI installations
        <IfModule !mod_php5.c>
            RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
        </IfModule>

    </IfModule>

</IfModule>
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#5
Yeah does it have to be so complicated?
Practical guide to IgnitedCMS - Book coming soon
Reply

#6
I use nearly the same version of Linux on my development system and my server (the primary difference being the configuration for use as a desktop machine), but my .htaccess on my development system is still slightly different (in part because my virtual hosts are configured in a slightly different manner).

The biggest issue I've run into is that Apache 2.4 changed a few things from previous versions (so back when I upgraded my server from Apache 2.2 I had to change most of my .conf and .htaccess files). One of my environments requires RewriteBase / while the other does not work unless I comment that line out. Additionally, mod_rewrite behaves slightly differently when you configure it in a .conf file vs. a .htaccess file (and, of course, you can configure a server to completely ignore .htaccess files). Finally, if someone doesn't use Apache, they may need a completely different set of options in a completely different file (maybe with a different format).

If someone can't get recommendations from their server administrator(s) on how to configure their server, they're probably going to have to spend some time really researching what the different commands do and how to use them properly for their server. The various .htaccess files out there now are a good resource as a starting point, but it's almost impossible to find one that works for even 90% of users.
Reply

#7
Yes this was my concern and looks like it is validated. For the time being I'm not shipping with a default .htaccess file. Thank you for you help thus far, I've just sent you another PM.
Practical guide to IgnitedCMS - Book coming soon
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.