Welcome Guest, Not a member yet? Register   Sign In
No input file specified - htaccess and /?/ after base_url
#3
Wink 
(This post was last modified: 12-02-2016, 01:05 PM by AzrielOmega.)

It works like a charm. Thank you so much for the sharing. I set uri_protocol to REQUEST_URI and here is my current .htaccess file

Code:
<IfModule mod_rewrite.c>
   RewriteEngine On

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

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

   # Restrict your site to only one domain
   # !important USE ONLY ONE OPTION

   # 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]

   # 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]

  # make HTTP Basic Authentication work on php-fcgi installs
  <IfModule mod_fcgid.c>
      RewriteCond %{HTTP:Authorization} .
      RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  </IfModule>

   # Send request via index.php if not a real file or directory
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d

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

   # no php-fcgi, check for sapi and fpm
   <IfModule !mod_fcgid.c>

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

       <IfModule !mod_php5.c>

           # for PHP7 sapi installations
           <IfModule mod_php7.c>
               RewriteRule ^(.*)$ index.php/$1 [QSA,L]
           </IfModule>

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

       </IfModule>

   </IfModule>

</IfModule>

<IfModule !mod_rewrite.c>
# Without mod_rewrite, route 404's to the front controller
ErrorDocument 404 /index.php
</IfModule>

AddDefaultCharset UTF-8
AddCharset utf-8 .html .css .js .xml

<IfModule mod_deflate.c>
    # Compress HTML, CSS, JavaScript, Text, XML and fonts
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
    AddOutputFilterByType DEFLATE application/x-font
    AddOutputFilterByType DEFLATE application/x-font-opentype
    AddOutputFilterByType DEFLATE application/x-font-otf
    AddOutputFilterByType DEFLATE application/x-font-truetype
    AddOutputFilterByType DEFLATE application/x-font-ttf
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE font/opentype
    AddOutputFilterByType DEFLATE font/otf
    AddOutputFilterByType DEFLATE font/ttf
    AddOutputFilterByType DEFLATE image/svg+xml
    AddOutputFilterByType DEFLATE image/x-icon
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/javascript
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/xml

    # Remove browser bugs (only needed for really old browsers)
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    Header append Vary User-Agent
</IfModule>

<IfModule mod_headers.c>
    # Serve gzip compressed CSS files if they exist
    # and the client accepts gzip.
    RewriteCond "%{HTTP:Accept-encoding}" "gzip"
    RewriteCond "%{REQUEST_FILENAME}\.gz" -s
    RewriteRule "^(.*)\.css" "$1\.css\.gz" [QSA]

    # Serve gzip compressed JS files if they exist
    # and the client accepts gzip.
    RewriteCond "%{HTTP:Accept-encoding}" "gzip"
    RewriteCond "%{REQUEST_FILENAME}\.gz" -s
    RewriteRule "^(.*)\.js" "$1\.js\.gz" [QSA]


    # Serve correct content types, and prevent mod_deflate double gzip.
    RewriteRule "\.css\.gz$" "-" [T=text/css,E=no-gzip:1]
    RewriteRule "\.js\.gz$" "-" [T=text/javascript,E=no-gzip:1]


    <FilesMatch "(\.js\.gz|\.css\.gz)$">
        # Serve correct encoding type.
        Header append Content-Encoding gzip

        # Force proxies to cache gzipped &
        # non-gzipped css/js files separately.
        Header append Vary Accept-Encoding
    </FilesMatch>
</IfModule>

<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/html "access plus 2 days"
    ExpiresByType image/jpg "access 1 year"
    ExpiresByType image/jpeg "access 1 year"
    ExpiresByType image/gif "access 1 year"
    ExpiresByType image/png "access 1 year"
    ExpiresByType text/css "access 1 month"
    ExpiresByType text/html "access 1 month"
    ExpiresByType application/pdf "access 1 month"
    ExpiresByType text/x-javascript "access 1 month"
    ExpiresByType application/x-shockwave-flash "access 1 month"
    ExpiresByType image/x-icon "access 1 year"
    ExpiresDefault "access 1 month"
</IfModule>

But I'm just curious about  rewrite "www.domain.com -> domain.com" and want to ask you for another favor: I'm using wildcard subdomain to navigate the language of my website. So how can I using htaccess file to narrow down the subdomains to available languages such as en.domain.com and fr.domain.com and redirect all other wildcard subdomains and www to domain.com ?
Reply


Messages In This Thread
RE: No input file specified - htaccess and /?/ after base_url - by AzrielOmega - 12-02-2016, 12:53 PM



Theme © iAndrew 2016 - Forum software by © MyBB