Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If the .htaccess already exist contao is not placing its own #70

Closed
netzarbeiter opened this issue May 29, 2018 · 11 comments
Closed

If the .htaccess already exist contao is not placing its own #70

netzarbeiter opened this issue May 29, 2018 · 11 comments
Labels

Comments

@netzarbeiter
Copy link
Member

netzarbeiter commented May 29, 2018

Some Webhoster are adding a .htaccess with an AddHandler in the web-folder if you change the PHP version.

For example: AddHandler application/x-httpd-php72 .php

Is it possible to merge the AddHandler during the creation of the .htaccess and overwrite the old version.

While testing the new Contao Manager everything went well, expect updating the database (domain.com/contao/install), while the needed lines in the .htaccess were missing.

@Toflar
Copy link
Member

Toflar commented May 29, 2018

I think that's a quite common case @contao/developers. If the .htaccess only contains AddHandler, I think we could add that, wdyt?

@m-vo
Copy link
Member

m-vo commented May 29, 2018

I don't think merging an .htaccess file is a good idea. There is too much that could go wrong.

(That by the way is another reason why shipping that file is problematic / related disucssion: #58)

@Toflar
Copy link
Member

Toflar commented May 29, 2018

I would do it only if AddHandler and only if AddHandler is present. As soon as there's other content in there, I wouldn't do anything at all.

@m-vo
Copy link
Member

m-vo commented May 29, 2018

Yeah, that would be fine then, I guess. We have to be careful, though. If something in the lines we're adding affects this php setting (and if it's presence is neccessary by the hoster), the server might e.g. deliver unparsed PHP.

@Toflar
Copy link
Member

Toflar commented May 29, 2018

The AddHandler case is just very, very common for virtual hosts, that's why I think that might be worth an exception.

@leofeyer
Copy link
Member

I don't think merging an .htaccess file is a good idea. There is too much that could go wrong.

I fully agree with this. We must not mess with an existing .htacces file!

@netzarbeiter
Copy link
Member Author

If you don't want to mess with an existing .htaccess, the Contao Manager should display a warning that the .htaccess could not have been written and were they get it from.

@zonky2
Copy link

zonky2 commented Aug 21, 2018

maybe it´s possible to write .htaccess-contao if another htaccess exist - it´s easier to copy one content to another htaccess...

@leofeyer
Copy link
Member

leofeyer commented Aug 30, 2018

As discussed in Mumble on August 30th, we want to check the existing .htaccess file for

/^\s*RewriteRule\s/im

and if there is no match, we want to append the .htaccess content. Additionally, we want to provide a .htaccess.default file, so people can look up what needs to be added.

@Toflar
Copy link
Member

Toflar commented Nov 3, 2018

PR ready: contao/contao#160

@leofeyer
Copy link
Member

leofeyer commented Nov 4, 2018

Thank you @Toflar. 👍

@leofeyer leofeyer closed this as completed Nov 4, 2018
leofeyer pushed a commit to contao/contao that referenced this issue Nov 15, 2018
Description
-----------

Implements contao/manager-bundle#70.

Commits
-------

6ea8dbf Added support for already existing htaccess without existing RewriteRule directive
426f9af Encapsulate the .htaccess logic in a separate method
leofeyer pushed a commit that referenced this issue Nov 15, 2018
Description
-----------

Implements #70.

Commits
-------

6ea8dbfd Added support for already existing htaccess without existing RewriteRule directive
426f9af0 Encapsulate the .htaccess logic in a separate method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants