Questions tagged [htaccess]
The htaccess tag has no usage guidance.
76 questions
1
vote
1
answer
63
views
How to use the primary locale handle as a fallback in the url?
I'm working on a Craft 4 project with five languages set up as separate sites. The primary site is configured to use 'en-GB' as the language and 'en' as the handle.
Currently, when I access the home ...
0
votes
1
answer
55
views
Redirect control panel access via .htaccess
I have a website that is hosted on a subdomain, let's say: https://subdomain.maindomain.nl.
My craft content is in the maindomain/public_html/subdomain/git-module
To make it work on the subdomain I ...
3
votes
1
answer
779
views
How can I serve a .json file from the web folder without CORS problems?
I have a .json file that I want to place somewhere in my web folder and serve this if my frontend (another domain) requests it. I can open the file directly but not
The problem is, that now I run into ...
0
votes
0
answers
546
views
Getting GraphQL working with Authorization header
In the docs, the following is written:
Apache strips Authorization headers by default, which can be fixed by enabling CGIPassAuth or adding the following to your .htaccess file:
RewriteCond %{HTTP:...
1
vote
1
answer
260
views
Craft CMS SSL added to website correctly but says insecure for admin panel
I have 2 websites one in craft cms 2 and the other in craft cms 3.
Everything works fine except the control panel always shows HTTPS insecure, for both the sites.
Below is my .htacces file,
<...
1
vote
1
answer
73
views
.htaccess not rewriting filenames
I'm not sure whether this is a Craft problem or whether I'm just not seeing something wrong.
For a test site with a folder structure like:
public
assets
css
I have this:
RewriteCond %{...
1
vote
1
answer
342
views
Incorrect canonical URLs and redirect chains
I have installed SEOMatic. However, I am getting incorrect canonical URLs. Here is an example: https://jenoffvanhulle.com/en/
The URL has a trailing slash, the canonical URL not
A second problem is ...
1
vote
1
answer
491
views
500 Internal Server Error when accessing admin
I just get a server error when trying to access /admin, or any other URL. This is a completely new installation on a staging server. The 'Welcome' page shows OK.
I'm guessing this is a .htaccess ...
1
vote
2
answers
70
views
Duplicate content from www and non-www
I am getting duplicate content issues because both www and non-www are being loaded.
My htaccess has the standard force https as all my other sites but it isn't working.
# START Force https
...
1
vote
1
answer
884
views
.htaccess file not rewriting url
Hi I'm having major problems trying to get my .htaccess file to rewriteRule or redirect one url to another. I've used .htaccess before on other cms installs and always work but for the life of me I ...
0
votes
0
answers
93
views
Craft 3 Multi-site with no “default” site AND where control panel login route remains intact and additional directories not necessary
Maybe one of you can help me out? I've tried setting up a multi-language site with no "default site" as per Craft 3 Multi-site with no "default" site. So far so good, except the control ...
1
vote
1
answer
2k
views
Refused to display/connect when previewing entry on multi-site setup
I run a multi-site setup with four sites; one on unicorn.com and one on all-your-base.com.
The way Craft CMS licensing works, you can run multiple sites on different domains on the same license/...
1
vote
0
answers
49
views
Override the language-part in URL and add a region (en-fr / fr-fr)
I ran into a problem one year ago, but our we changed the specifications and so it was not neccessary anymore(another question here commented).
One year later now, the issue is back, harder as before ...
2
votes
1
answer
509
views
Combine .htaccess. ( http to https AND www to non www AND remove trailing slash ) extending normal craftcms .htaccess
I can't manage to combine all above options. Tested with several options and examples only the most examples focusses only on on problem.
The example of .htaccess below is okay but i cannot manage to ...
1
vote
1
answer
330
views
Can't Get Past Control Panel Login. Keeps Redirecting Back to Login Page
I followed this guide to move my local hosting from WAMP, which has been giving me a bunch of 500 errors since switching to Craft 3, to Local By Flywheel. After getting everything configured, I can ...
2
votes
2
answers
891
views
Multi-site Live Preview not working in Craft 3
In the multi-site Live Preview in admin panel show error in the console.
Failed to load http://www.example.local/test: The value of the 'Access-Control-Allow-Origin' header in the response must not ...
1
vote
1
answer
334
views
Forcing a / with .htaccess
After redirecting a website to https environment I had the difficulty that .php/ was added to the url which resulted in double content. I have been able to get past this mistake but now I need to ...
1
vote
1
answer
654
views
Force redirect from HTTP to HTTPS via htaccess with multisite installation
I'm using Craft CMS 3 multisite installation with more than 20 website based on subdomains.
There are websites:
website.com
one.website.com
two.website.com
with identical url paths but different ...
3
votes
1
answer
5k
views
No input file specified - [proxy_fcgi:error] Got error 'Unable to open primary script: [PATH]/html/index.php (No such file or directory)\n'
I have a peculiar situation that is only happening on the root domain and NOT subdomains.
For example, CraftCMS (2.6.3019) running on Apache with php-fpm works fine on dev.some-domain.tld and test....
1
vote
0
answers
33
views
Craft 3: Prevent craft adding script filename to URLS
I'm running Craft 3 with multi-site.
Working well so far, but my hosting doesn't allow me to create traditional vhosts with their own directories and shared upper filesystem.
As such I have an ...
1
vote
1
answer
619
views
How do I force www in URL along with the Patrol plugin to force https
I'm using the Patrol plugin to force https in the domain, but I also need to force www into the URL. When I do that with some htaccess rewrite rules I found online I get an error when I try to load ...
1
vote
1
answer
615
views
Installing Craft in a Sub Folder
I have created a Craft CMS site on a VPS Server running CentOS 7. I have a file setup on the public_html like this: -
cms
craft
public
app (this is running a Symfony Framework Web App and runs from ...
1
vote
1
answer
135
views
Simple Craft htaccess Help
I have a Craft site where I need to redirect any traffic to www (including dev.lakesideohio.com). The rule seems to be working but for some reason the url gets changed to using index.php with query ...
3
votes
1
answer
960
views
Force language segment in URL on multi-lingual site
I'm setting up a multi-lingual site and want to force the language segments:
domain.com/en/
domain.com/fr/
However if you go in the URL bar and remove the en/ or fr/ it loads up the English page ...
0
votes
1
answer
124
views
Adding `www` causing it to have index.php
I am trying to get pretty urls
In my general.php file I have
'omitScriptNameInUrls' => true,
which works fine and removes the index.php
BUT
When I try to force a www in the htaccess the ...
0
votes
2
answers
269
views
entry.url forcing https
{{ entry.url }} is generating a https:// link. I don't have SSL on this site, so the page errors out.
Settings > General > Site Url is "http://..."
My .htaccess is below (though I've read the ...
2
votes
2
answers
3k
views
Anyone with a tricked out .htaccess file
I am looking at shaving www. and enforcing https on the entire site without a plugin. All along removing the index.php.
Here is my .htaccess file, it works but is it optimized. If you have any ...
1
vote
2
answers
4k
views
GZIP seems to compress only HTML, not CSS or JavaScript
I'm not 100% sure this is a Craft specific problem, but I'll try here, as it relates to a Craft installation.
After running a number of tests, it seems that my CSS and JavaScript files are not ...
1
vote
3
answers
2k
views
Security Headers in htaccess Don't Work
We have an issue on our server when our Security Headers are not working. We added the following to our htaccess file after installing Craft CMS: -
<IfModule mod_headers.c>
Header always ...
3
votes
2
answers
361
views
Printmaker fails to render images under SSL
I am using the Printmaker plugin to print a pdf. Everything seems to be working well when the site is not being forced to use SSL.
I am getting the message "Failed to load PDF document."
If I remove ...
1
vote
1
answer
934
views
.htaccess for Craft CMS - removing segment from URL
I'm rebuilding a website which needs to run Craft CMS as the main frontend and a bespoke CRM system at the same domain.
The file setup is basically
public_html
cms
crm
To make things a bit more ...
1
vote
1
answer
280
views
HTTPs Site - Redirects Go to HTTP First & Then HTTPs
So I've updated the site URL in my general.php as follows:
'siteUrl' => "https://" . $_SERVER['HTTP_HOST'],
I also have our web server making sure everything goes to https://www.example.com. ...
1
vote
1
answer
2k
views
Craft CMS login 500 (Internal Server Error)
I transferred a website using Craft CMS and now when I want login to admin the console return me
jquery-2.2.1.min.js?d=1493126871:4 POST http://website.com/index.php/admin/actions/users/login 500 (...
1
vote
0
answers
685
views
301 redirects are inserting "index.php" into URLs
I'm in the process of moving a site from one domain to another, so I'm setting up 301 redirects on the old domain. Everything goes well, except when the 301 redirect happens, "index.php" is inserted ...
1
vote
0
answers
611
views
.htaccess trailing slashes and ajax calls
I'm building something with Craft and Vue.js and realized that I could view my page with or without a trailing slash, but when it had a trailing slash, my ajax calls to the Element API endpoint failed,...
2
votes
1
answer
3k
views
How to remove index.php?p= permanently?
I discovered search engines found duplicate content on my domain due to URLs being output with index.php?p= and index.php in ADDITION to the clean URLs.
For example, I have:
domain.com/index.php?p=...
1
vote
2
answers
518
views
Why is htaccess file not named ".htaccess" on fresh install?
I run into the same error on each project setup with CraftCMS. So did I this time… again…
First of all: Yes, I seem to be a slow learner. And therefore I can't memorize to rename the htaccess file ...
2
votes
2
answers
1k
views
htaccess non-www rewrite showing index.php in URL
I am using htaccess to rewrite any www url to a non-www version
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
When I type domain.com/...
1
vote
0
answers
364
views
Configuring CraftCMS on Arcustech with Cloudflare flexible SSL returns 521 error
I have installed CraftCMS on an Arcustech VPS and successfully added a domain name. Using the domain without the shared SSL works without any problems (e.g. www.example.com / example.com). However ...
0
votes
1
answer
318
views
Misconfiguration error when accessing URL without file name
When accessing www.myurl.com/services, I get this error below the content of my page:
The server encountered an internal error or misconfiguration and was unable to complete your request.
I don't ...
1
vote
1
answer
372
views
Cannot omit index.php from URL
I know this question has come up many times before, although after reading and trying dozens of answers, I am none the wiser.
I am currently rebuilding my website with Ubuntu 16.04, PHP7 and apache. ...
4
votes
1
answer
836
views
Cannot remove index.php from URLs either
I am having the same issue as here: Another index.php?p= problem
I tried to post this as a comment rather than open another post but I don't have enough reputation...
I have tried all of the ...
1
vote
0
answers
218
views
htpasswd issues with Craft
So I raised a previous thread here.
https://craftcms.stackexchange.com/questions/16741/conflict-with-htaccess-htpswd
Basically with the site behind a htpasswd (as it is a staging url) after ...
1
vote
1
answer
172
views
'Unknown error' caused by redirect in htaccess
I was getting an 'unknown error' when trying to access the admin. I couldn't see anything in the Craft logs apart from 404 related errors.
I replaced the app folder but still no luck, eventually I ...
1
vote
1
answer
517
views
Issue with htaccess redirect adding parameters
Having an issue with htaccess redirects adding parameters to the new locations. I have done some research on this and apparently its from the default htaccess rules. I have tried a few suggestions ...
3
votes
1
answer
618
views
Site will not load. Asking me to save "login" as a file
What would make a site want me to download the index.php when viewed? I downloaded the database and all files from a staging server where site was fine. When I go to any site URL on local machine it ...
1
vote
2
answers
4k
views
When redirecting to HTTPS from www, index.php appears in URL
I have a redirect setup for www, it successfully redirects to https:// but it includes /index.php?p= in the URL. I'm not convinced by htaccess file is configured correctly.
Here's my htaccess file:
...
1
vote
2
answers
164
views
Migrate WordPress Site into Craft CMS. How deal with 404's?
I migrate my WordPress site into Craft CMS. So far so good.
But the URLs for most of the Blog Entries are complete new. What's the best way to handle that? My site is good linked on Google and there ...
1
vote
0
answers
951
views
htaccess and favicons
I see from the Craft's default remove index.php htaccess code here that the following line takes into account favicon.ico files.
RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [...
5
votes
2
answers
2k
views
Why am I getting ?p=oldpage in a 301 redirect?
Not sure whether this is directly related to Craft but I’ve been using this method for years and it has always worked with other sites.
I’m replacing an old site and some pages have moved. I want to ...