Skip to main content
9 votes
Accepted

Why is htaccess file not named ".htaccess" on fresh install?

Because files that start with a . are considered "hidden" by many file systems (specifically OSX default). If the file is hidden, then there's a good chance that the user won't know about it, and won'...
Lindsey D's user avatar
  • 24.1k
7 votes
Accepted

How to remove index.php?p= permanently?

Taken from this answer on Stack Overflow: .htaccess mod_rewrite: rewriting querystring to path <IfModule mod_rewrite.c> RewriteEngine On # Remove index.php RewriteCond %{...
Alex Roper's user avatar
  • 2,642
7 votes
Accepted

No input file specified - [proxy_fcgi:error] Got error 'Unable to open primary script: [PATH]/html/index.php (No such file or directory)\n'

It turned out that the problem was from customizing the domain's document root in the userdata files and then the PHP-FPM configuration had not been rebuilt and the service not restarted. The ...
ylluminate's user avatar
5 votes
Accepted

Anyone with a tricked out .htaccess file

Been using this one for years, works great: <IfModule mod_rewrite.c> RewriteEngine On # ========================================= # # Force website to use "www" RewriteCond %{...
Lindsey D's user avatar
  • 24.1k
4 votes
Accepted

Cannot remove index.php from URLs either

In this case, the Apache mod_rewrite module wasn't installed, so the <IfModule mod_rewrite.c> block of Craft's default .htaccess file was being skipped not allowing index.php to be rewritten in ...
Brad Bell's user avatar
  • 67.5k
4 votes

500 Internal Server Error when accessing admin

It turned out that RewriteBase / needed to be added to the htaccess
Andrew's user avatar
  • 748
3 votes

Adding `www` causing it to have index.php

Your .htaccess is basically saying "Redirect example.com to www.example.com". OK, that's cool. so you want to add www to any request that a comes in. I'm guessing you put this after Craft's code? ...
RitterKnight's user avatar
  • 6,582
3 votes

Anyone with a tricked out .htaccess file

Since you mentioned in an earlier post that you are performance-minded, this might interest you: Stop using .htaccess files! No, really.
andrew.welch's user avatar
  • 11.6k
3 votes
Accepted

Printmaker fails to render images under SSL

UPDATE 2/Resolution I don't really have an explanation for what was happening. Hopefully this will help others if they experience the same. I'm happy to update the answer however if anyone has ...
Damon's user avatar
  • 4,706
2 votes

redirect index.php in urls on Craft site to NEVER show index.php

Don't forget to rewrite "?p=" as well... # remove index.php RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC] RewriteCond %{REQUEST_URI} !^/index\.php/admin\b [NC] RewriteRule (.*?)index\.php/*(.*) /$...
Leo Leoncio's user avatar
2 votes

'Unknown error' caused by redirect in htaccess

It might be down to the order you have the code in your htaccess file? Did you try putting your code above the Craft rewrite code? # redirect PHP or HTM to no extension RewriteCond %{THE_REQUEST} ^[A-...
Terry Upton's user avatar
  • 1,894
2 votes

Why is htaccess file not named ".htaccess" on fresh install?

It depends on how you run Craft. I use Valet which doesn't work with Apache. It's basically there if you need it, but it's not mandatory.
Thomas Claessens's user avatar
2 votes

Security Headers in htaccess Don't Work

I'm assuming mod_headers is installed & active? Otherwhise I can't say why the .htaccess rules are not applied (devOps is not my forte) but you could set them through the twig template. See here ...
mrsmn's user avatar
  • 731
2 votes

Craft CMS login 500 (Internal Server Error)

remove /craft/storage/runtime and remove all craft_session and database
alex's user avatar
  • 21
2 votes

Cannot omit index.php from URL

I have found the solution within the answered question: omitScriptNameInUrls is not working 'sudo a2enmod rewrite' was needed! Thanks all.
user5989's user avatar
2 votes

GZIP seems to compress only HTML, not CSS or JavaScript

Apache supports gzip with two compression modules: mod_gzip and mod_deflate. The latter is supposedly more widely available but some hosts may have one or the other. mod_gzip is the older of the ...
RitterKnight's user avatar
  • 6,582
2 votes

GZIP seems to compress only HTML, not CSS or JavaScript

You can use .htaccess config from HTML Boilerplate for better configuration. There are a lot of useful config option there. I use this config to enable gzip compression in my personal blog, and it's ...
Jefry Dewangga's user avatar
2 votes

Force language segment in URL on multi-lingual site

Make sure to remove Craft’s default rewrite rule (“Send would-be 404 requests to Craft”) from the .htaccess in your document root, so it’s only in the .htaccess files of your locales’ subfolders. You ...
carlcs's user avatar
  • 36.3k
2 votes

How do I force www in URL along with the Patrol plugin to force https

This is how our default .htaccess with https redirect and forced www. for all our projects looks like. So if you have the url example.com you'll get redirected to https://www.example.com. <...
Robin Schambach's user avatar
2 votes

Combine .htaccess. ( http to https AND www to non www AND remove trailing slash ) extending normal craftcms .htaccess

Update 12/06/2018: Tested now succesfully following version on my server # Redirect www to non www RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ https://%1/$1 [R=301,L] # Redirect ...
phaetons's user avatar
  • 705
2 votes
Accepted

Refused to display/connect when previewing entry on multi-site setup

X-Frame-Options The problem is that your site's .htaccess file prevents unicorn.com from viewing all-your-base.com in an iframe because the X-Frame-Options header has not been configured for allowing ...
2 votes

.htaccess not rewriting filenames

Craft doesn’t get involved in .htaccess redirects at all, so whatever it is, it’s going to be a server config thing. Some things to check: Is this server actually using Apache and not Nginx? Is ...
Brandon Kelly's user avatar
2 votes
Accepted

How to use the primary locale handle as a fallback in the url?

I think the issue is that your first RewriteCond only excludes the language prefix in the path with a trailing slash. The regex matches /en/ and /fr/, but not /en and /fr. To fix this, make the ...
MoritzLost's user avatar
  • 11.7k
1 vote

entry.url forcing https

You could try and add the following condition to the .htaccess which should redirect everything to http, perhaps it'll work: RewriteCond %{HTTPS} off
Gįëł Tėttëłæår's user avatar
1 vote

entry.url forcing https

I got the link to work, but it seems like a dumb workaround. For some reason, http://example.com redirects to https://example.com when I use {{ entry.Url }}, but when I use http://www. the redirect ...
Jeff Fulton's user avatar
1 vote

Security Headers in htaccess Don't Work

This is more of a server config issue than a Craft one. Craft does set a few of those headers from PHP, but only for Control Panel requests. It's completely hands-off on the front-end of your site ...
Brad Bell's user avatar
  • 67.5k
1 vote

Printmaker fails to render images under SSL

Check your urls in your admin panel - e.g. the site url under the "General" panel, and then also anything under Assets. Is that set to be https? Or just http? If, for example, your asset folder is ...
SamC's user avatar
  • 482
1 vote
Accepted

.htaccess for Craft CMS - removing segment from URL

I might be way off here, but if you are wanting to run Craft as your main front-end, could you not place the Craft index.php in the root of the site and then you CRM in a sub-folder of its own? If ...
Steve Holland's user avatar
1 vote
Accepted

HTTPs Site - Redirects Go to HTTP First & Then HTTPs

Think we figured out the root cause of this - we have a load balancer in front of our origin server and, long story short, that load balancer was communicating with our origin server via HTTP, causing ...
dpayne's user avatar
  • 659
1 vote

htaccess non-www rewrite showing index.php in URL

The answer to this question was the positioning of content in the .htaccess file. Move: RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^ %{ENV:PROTO}://%1%{...
zizther's user avatar
  • 449

Only top scored, non community-wiki answers of a minimum length are eligible