nextcloud / nextcloud/server

Simplify `.htaccess` redirect ruleset

Open
#52,709 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage feature: install and update technical debt
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

The .htaccess RewriteCond and RewriteRule looks kind of complicated:

https://github.com/nextcloud/server/blob/0b354efb22a05a061275c2bb1a9c715a70d074d8/lib/private/Setup.php#L570-L579

How about implementing a simpler ruleset.

E.g. see TYPO3 .htaccess for an idea:

https://github.com/TYPO3/typo3/blob/18dc58b93f75c64521f77f80fa42d1564b6b7eb7/typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/root-htaccess#L329-L334

	# If the file/symlink/directory does not exist => Redirect to index.php.
	# For httpd.conf, you need to prefix each '%{REQUEST_FILENAME}' with '%{DOCUMENT_ROOT}'.
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
	RewriteCond %{REQUEST_FILENAME} !-l
	RewriteRule ^.*$ %{ENV:CWD}index.php [QSA,L]
How to use GitHub
  • Please use the 👍 reaction to show that you are interested into the same feature.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect lib/private/Setup.php around lines 570-579 and compare the proposed TYPO3 .htaccess ruleset with Nextcloud's current generated rules. Determine whether the simpler conditions preserve Nextcloud's routing behavior, then update the generated rules so nonexistent files, directories, and symlinks reach index.php without breaking existing requests.

Written by the indexing model from the issue text.

Assessment

Tech stack
apache, php
Domain
devops
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.