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,572
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
  • 23.9k
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,622
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

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

As another option that I usually do in addition to .htaccess, is to also add this to the array in craft/config/general.php file, and it'll stop Craft from ever adding the index.php. '...
Taylor Daughtry'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
  • 23.9k
4 votes
Accepted

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

This came up in the Craft Slack not so long ago. You'd want something like this... # ------------------------------------------------------------ # Remove index.php # ---------------------------------...
Jamie Pittock's user avatar
4 votes
Accepted

htaccess www to non-www with subdomain

This question comes close but implementing with a subdomain doesn't work. It should work as long as you modify the rewrite rule to account for the subdomain: RewriteCond %{HTTP_HOST} !^foo\.bar\.com$...
Brandon Kelly's user avatar
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
  • 896
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.2k
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
  • 740
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.2k
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,572
3 votes

Multi locale, multi-domain Live Preview failing

Only setting headers in .htaccess doesn't fix the problem. As Marion Newlevant points out in her answer the cross domain works with the headers set. But you still get a white page as a preview. ...
Ruben Webs's user avatar
3 votes

How can I use images from my live Craft Site when developing locally

You could set up your assets through Amazon S3 or another remote service then that wouldn't be a problem. Alternatively you will need to download all the assets locally if you have relative paths /...
joep's user avatar
  • 610
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

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

Removing index.php from URL even after .htaccess updates?

After playing around, I found a solution. I hope this helps anyone in the future: # ------------------------------------------------------------ # Remove index.php # ----------------------------------...
dauble's user avatar
  • 75
2 votes
Accepted

Removing index.php from URL even after .htaccess updates?

There's nothing unique or special for doing this with Craft CMS - you should be able to use this method for just about any web app running in a LAMP stack. See this post on removing index.php from the ...
Nick Benson's user avatar
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/*(.*) /$...
Leoncio's user avatar
  • 463
2 votes

Re-using path segments for an additional domain?

In Craft, there is no such thing as a "section path" – there's only the "Entry Template" path (which tells Craft which template to load when the URL for an Entry in that particular section is ...
Mats Mikkel Rummelhoff'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,884
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

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

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

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

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