9 votes
Accepted

Why am I getting ?p=oldpage in a 301 redirect?

Craft works by taking requests that normally would 404—because they don't actually exist on the server but in the database. The piece that makes this happen is the rewrite rules. It's helpful to ...
RitterKnight's user avatar
  • 6,582
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
  • 24k
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,632
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
  • 24k
4 votes
Accepted

.htaccess max_execution_time

You can alter the index.php file and add [set_time_limit][1](300); anywhere below the <?php tag. You can also try to set it by ini_set('max_execution_time', 300); For the reason why it returns a ...
chris's user avatar
  • 906
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
  • 738
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
3 votes

Migrate WordPress Site into Craft CMS. How deal with 404's?

David, I like using Reroute. It's a Craft plugin that lets you create 301s and 302s to any of your entry pages within Craft.
Tim Knight's user avatar
  • 1,022
3 votes
Accepted

When redirecting to HTTPS from www, index.php appears in URL

There are docs for removing index.php from your URLs here: https://craftcms.com/support/remove-index.php There are also docs for enforcing SSL for all CP requests here: https://craftcms.com/support/...
Brad Bell's user avatar
  • 67.5k
3 votes

Site will not load. Asking me to save "login" as a file

You need to remove this when running local. The following piece of code is added on servers running the EasyApache4 PHP Handler. # php -- BEGIN cPanel-generated handler, do not edit # Set the "ea-...
Bryan Garrant's user avatar
3 votes
Accepted

Remove subdirectories from admin URL with .htaccess

I have Craft public files set up within subdirectories of a primary domain’s web root. The following .htaccess rules allow for the public_html subdirectory to act as the new web root. Is there a ...
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

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

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

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

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.2k
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.3k
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

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