genj / short-url-bundle
Symfony Short Url bundle
Installs: 3 238
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 4
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- gedmo/doctrine-extensions: ~2.3
- sensio/framework-extra-bundle: ~3.0
- symfony/symfony: >=2.5,<3.0-dev
This package is not auto-updated.
Last update: 2024-02-17 13:50:43 UTC
README
Provides a way to redirect requests based on an Entity stored in the database. Features:
- redirect client based on the request path, e.g. '/something'
- internal and external redirects to a path or url
- with start/end datetime
- configurable http status code
- keeps the query string parameters when redirecting
Installation
Add this to your composer.json:
...
"require": {
...
"genj/short-url-bundle": "dev-master"
...
Then run composer update
. After that is done, enable the bundle in your AppKernel.php:
# app/AppKernel.php
class AppKernel extends Kernel
{
public function registerBundles() {
$bundles = array(
...
new Genj\ShortUrlBundle\GenjShortUrlBundle()
...
Finally, update your database schema:
php app/console doctrine:schema:update
And you're done.
Usage
Add a new record to your database. Example:
- source: /my-old-url
- target: /my-new-url
- httpStatusCode: 301
- publishAt: (now)
FAQ
My redirect is not working through app.php, but it works through app_dev.php
If you have enabled caching, it can happen that a 404 response is stored in the http cache, so clear your caches. The redirect requests themselves have private caching headers.