zenstruck / redirect-bundle Goto Github PK
View Code? Open in Web Editor NEWStore redirects for your site and keeps statistics on redirects and 404 errors.
License: MIT License
Store redirects for your site and keeps statistics on redirects and 404 errors.
License: MIT License
RedirectDto
to be used by the form type (will require a custom unique entity validator until symfony/symfony#38662 is available)Redirect
statsNotFound
NotFound
changes
SimpleNotFound
: single row for each source with count/last accessedAdvancedNotFound
: row for every 404 occurrence (same as 3.x)absolute
(false by default): include domain/scheme in sourceinclude_query
(false by default): include query in sourceabout
-> /about
Hi buddy!
We were just upgrading to the latest version of the bundle, and suddenly our EntityManager couldn't be autowired into any services anymore! The problem is that this bundle introduces a second service, which uses this class: https://github.com/kbond/ZenstruckRedirectBundle/blob/7504b70a46ab663273a1437bbbdbe37091591a65/src/Resources/config/orm.xml#L8
I see that the purpose is to be able to control which entity manager is used. Could this be done in a simpler way with an alias? For example, don't actually create a service called zenstruck_redirect.entity_manager
, simply set an alias in the container so that zenstruck_redirect.entity_manager
is an alias to the correct entity manager service (e.g. doctrine.orm.default_entity_manager
where default
changes to be the model_manager_name
config). This would avoid needing to add the additional service to the container, which causes the issue.
And to really try to tug at your heart-strings... it's even technically (though barely) more performant! The current method requires an extra call to $container->get('doctrine')->getManager()
to get the service, instead of re-using the existing. Ok, this last reason is CRAP, and would save only 1ms every 1000 requests... but I'm just trying to sweeten the deal ;).
Cheers!
Since hash tags are not set to the server a controller will be necessary.
Source: if source has multiple variations of the same path in the db, send them all to the controller and use javascript to determine the correct destination
use javascript just to redirect to the controller with the url encoded
Hey @kbond, it's me again :)
FYI: You can create your own Symfony Flex recipe so the default configuration is added automatically when installing your bundle via composer
I'll try to get pull some time next week and push a PR, but if you do it before that I won't mind ;)
Hi,
I have followed the whole installation (bundle in kernel, creation of the notFound and redirect entities + DB update, default config). My config is:
zenstruck_redirect:
redirect_class: AppBundle\Entity\Redirect
not_found_class: AppBundle\Entity\NotFound
model_manager_name: ~
remove_not_founds: true
As I understand one of my user falls on a 404 error, either the notfound DB will have a new row added to it or the user will be redirected to the right url included in my redirects. It does not do it.
For a new redirect, what is the exact code with parameters?
For an edit, symfony tells me: Could not load type "zenstruck_redirect"
I am unsure of what that means.
Thanks a lot for your time and this awesome bundle!
Thanks
$ composer require zenstruck/redirect-bundle
Using version ^3.3 for zenstruck/redirect-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "5.1.*"
Your requirements could not be resolved to an installable set of packages.
Problem 1
- zenstruck/redirect-bundle v3.3.2 requires symfony/framework-bundle ^2.8|^3.0|^4.0 -> no matching package found.
- zenstruck/redirect-bundle v3.3.1 requires symfony/framework-bundle ^2.8|^3.0|^4.0 -> no matching package found.
- zenstruck/redirect-bundle v3.3.0 requires symfony/framework-bundle ^2.8|^3.0|^4.0 -> no matching package found.
- Installation request for zenstruck/redirect-bundle ^3.3 -> satisfiable by zenstruck/redirect-bundle[v3.3.0, v3.3.1, v3.3.2].
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
- It's a private package and you forgot to add a custom repository to find it
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
Installation failed, reverting ./composer.json to its original content.
Please add support for Symfony4. Thanks!
Hello there,
I have a fairly large project and your bundle would fit in great with it, aside from one hiccup. The only issue I have is that I have multiple subdomains in my project. When I try to save a redirect it automatically transforms 'https://suba.domain.com/test' to '/test' even though I would like to control multiple sub domains. The redirect happens on all subdomains instead of this one. I assume multiple subdomain functionality is not built in the project.
There are also some issues with inheritance because the model has all private methods, so overwriting functions is impossible as well.
I was thinking about just forking your bundle and using for my own projects, but would you be interested in a PR for this functionality?
EDIT: I added a PR for the extensible classes:
#27
The composer.json dependencies don't work with Symfony 2.1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.