Add .htaccess with PHP-FPM 8.4 config and URL rewrites for blog posts #15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a comprehensive
.htaccessconfiguration to enable clean blog URLs and fix failing workflow smoketests.Problem
The workflow smoketests were failing because they expected both legacy blog URLs (
/blog.php?post=slug) and clean URLs (/blog/slug) to work, but only the legacy format was functional. The clean URLs returned 404 errors.Solution
Added a complete
.htaccessfile with:1. PHP-FPM PHP 8.4 Configuration
2. URL Rewrite Rules
This rule:
/blog/a-dotnet-developers-php-api/blog.php?post=captured-slug[QSA]flag3. Security Enhancements
.md,.env,composer.*, etc.)/src/,/templates/,/tests/, etc.)4. Performance Optimizations
Testing
Added comprehensive test coverage in
tests/Integration/HtaccessRewriteTest.phpthat validates:Impact
After deployment, these URL formats will work identically:
/blog/a-dotnet-developers-php-api/blog.php?post=a-dotnet-developers-php-apiThe workflow smoketests will pass because both URL formats now return HTTP 200 with the expected blog content.
Documentation
Added
README_HTACCESS.mdwith detailed explanation of the configuration, examples, and future extension notes.Fixes #14.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/3ba905c11371512af9d9bdd27d99b782216b6945/usr/bin/php8.3 -n -c /tmp/Dyi8tE composer.phar install --no-dev --no-interaction --prefer-dist(http block)https://api.github.com/repos/cocur/slugify/zipball/1d674022e9cbefa80b4f51aa3e2375b6e3c14fdb/usr/bin/php8.3 -n -c /tmp/Dyi8tE composer.phar install --no-dev --no-interaction --prefer-dist(http block)https://api.github.com/repos/dflydev/dflydev-dot-access-data/zipball/a23a2bf4f31d3518f3ecb38660c95715dfead60f/usr/bin/php8.3 -n -c /tmp/Dyi8tE composer.phar install --no-dev --no-interaction --prefer-dist(http block)https://api.github.com/repos/nette/schema/zipball/da801d52f0354f70a638673c4a0f04e16529431d/usr/bin/php8.3 -n -c /tmp/Dyi8tE composer.phar install --no-dev --no-interaction --prefer-dist(http block)https://api.github.com/repos/nette/utils/zipball/c930ca4e3cf4f17dcfb03037703679d2396d2ede/usr/bin/php8.3 -n -c /tmp/BCh77G composer.phar install --no-dev --no-progress(http block)/usr/bin/php8.3 -n -c /tmp/Dyi8tE composer.phar install --no-dev --no-interaction --prefer-dist(http block)https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0/usr/bin/php8.3 -n -c /tmp/Dyi8tE composer.phar install --no-dev --no-interaction --prefer-dist(http block)https://api.github.com/repos/phpstan/phpstan/zipball/0835c625a38ac6484f050077116b6668bc3ab57d/usr/bin/php8.3 -n -c /tmp/tmRs7H composer.phar install --no-interaction --prefer-dist(http block)https://api.github.com/repos/schmittjoh/php-option/zipball/638a154f8d4ee6a5cfa96d6a34dfbe0cffa9566d/usr/bin/php8.3 -n -c /tmp/Dyi8tE composer.phar install --no-dev --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/global-state/zipball/3be331570a721f9a4b5917f4209773de17f747d7/usr/bin/php8.3 -n -c /tmp/tmRs7H composer.phar install --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/f5b498e631a74204185071eb41f33f38d64608aa/usr/bin/php8.3 -n -c /tmp/tmRs7H composer.phar install --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/6e1a43b411b2ad34146dee7524cb13a068bb35f9/usr/bin/php8.3 -n -c /tmp/tmRs7H composer.phar install --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/f6458abbf32a6c8174f8f26261475dc133b3d9dc/usr/bin/php8.3 -n -c /tmp/tmRs7H composer.phar install --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/type/zipball/f77d2d4e78738c98d9a68d2596fe5e8fa380f449/usr/bin/php8.3 -n -c /tmp/tmRs7H composer.phar install --no-interaction --prefer-dist(http block)https://api.github.com/repos/sebastianbergmann/version/zipball/c687e3387b99f5b03b6caa64c74b63e2936ff874/usr/bin/php8.3 -n -c /tmp/tmRs7H composer.phar install --no-interaction --prefer-dist(http block)https://api.github.com/repos/staabm/side-effects-detector/zipball/d8334211a140ce329c13726d4a715adbddd0a163/usr/bin/php8.3 -n -c /tmp/tmRs7H composer.phar install --no-interaction --prefer-dist(http block)https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62/usr/bin/php8.3 -n -c /tmp/Dyi8tE composer.phar install --no-dev --no-interaction --prefer-dist(http block)https://api.github.com/repos/symfony/finder/zipball/2a6614966ba1074fa93dae0bc804227422df4dfe/usr/bin/php8.3 -n -c /tmp/Dyi8tE composer.phar install --no-dev --no-interaction --prefer-dist(http block)https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638/usr/bin/php8.3 -n -c /tmp/Dyi8tE composer.phar install --no-dev --no-interaction --prefer-dist(http block)https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493/usr/bin/php8.3 -n -c /tmp/Dyi8tE composer.phar install --no-dev --no-interaction --prefer-dist(http block)https://api.github.com/repos/symfony/polyfill-php80/zipball/0cc9dd0f17f61d8131e7df6b84bd344899fe2608/usr/bin/php8.3 -n -c /tmp/Dyi8tE composer.phar install --no-dev --no-interaction --prefer-dist(http block)https://api.github.com/repos/thephpleague/commonmark/zipball/10732241927d3971d28e7ea7b5712721fa2296ca/usr/bin/php8.3 -n -c /tmp/Dyi8tE composer.phar install --no-dev --no-interaction --prefer-dist(http block)https://api.github.com/repos/thephpleague/config/zipball/754b3604fb2984c71f4af4a9cbe7b57f346ec1f3/usr/bin/php8.3 -n -c /tmp/Dyi8tE composer.phar install --no-dev --no-interaction --prefer-dist(http block)https://api.github.com/repos/twigphp/Twig/zipball/285123877d4dd97dd7c11842ac5fb7e86e60d81d/usr/bin/php8.3 -n -c /tmp/Dyi8tE composer.phar install --no-dev --no-interaction --prefer-dist(http block)https://api.github.com/repos/vlucas/phpdotenv/zipball/24ac4c74f91ee2c193fa1aaa5c249cb0822809af/usr/bin/php8.3 -n -c /tmp/Dyi8tE composer.phar install --no-dev --no-interaction --prefer-dist(http block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.