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 ...
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'...
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 %{...
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 ...
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.
'...
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 %{...
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
# ---------------------------------...
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$...
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 ...
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 ...
4
votes
500 Internal Server Error when accessing admin
It turned out that RewriteBase / needed to be added to the htaccess
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.
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/...
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-...
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 ...
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.
...
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 /...
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 ...
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.
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?
...
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
# ----------------------------------...
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 ...
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/*(.*) /$...
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 ...
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-...
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.
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.
2
votes
Craft CMS login 500 (Internal Server Error)
remove /craft/storage/runtime and remove all craft_session and database
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
htaccess × 75redirect × 18
url × 10
craft3 × 8
apache × 7
control-panel × 6
ssl × 6
https × 6
login × 4
templating × 3
localization × 3
config × 3
error × 3
install × 3
routing × 3
index × 3
php × 2
error-message × 2
routes × 2
404 × 2
security × 2
live-preview × 2
structure × 1
image-transforms × 1
image × 1