Giter Club home page Giter Club logo

oc-redirect-plugin's Introduction

Vdlp.Redirect

Manage all your HTTP redirects with an easy to use GUI. This is an essential SEO plugin.

The #1 Redirect plugin for October CMS

This is the best Redirect-plugin for October CMS. With this plugin installed you can manage redirects directly from October CMS' beautiful interface. Many webmasters and SEO specialists use redirects to optimise their website for search engines. This plugin allows you to manage such redirects with a nice and user-friendly interface.

History

This plugin was originally build in 2016 by Alwin Drenth a Software Engineer at Van der Let & Partners. As of 2018 this plugin is re-distributed to the October CMS Marketplace with vendor name Vdlp.Redirect (formerly known as Adrenth.Redirect).

The Redirect plugin will now be maintained by Van der Let & Partners and You (the open source community).

What does this plugin offer?

This plugin adds a 'Redirects' section to the main menu of October CMS. This plugin has a unique and fast matching algorithm to match your redirects before your website is being rendered.

Features

  • Quick matching algorithm
  • A test utility for redirects
  • Matching using placeholders (dynamic paths)
  • Matching using regular expressions
  • Exact path matching
  • Importing and exporting redirect rules
  • Schedule redirects (e.g. active for 2 months)
  • Redirect to external URLs
  • Redirect to internal CMS pages
  • Redirect to relative or absolute URLs
  • Redirect log
  • Categorize redirects
  • Statistics
    • Hits per redirect
    • Popular redirects per month (top 10)
    • Popular crawlers per month (top 10)
    • Number of redirects per month
    • And more...
  • Multilingual (Need help translating! Contact us at [email protected])
  • Supports MySQL, SQLite and Postgres
  • HTTP status codes 301, 302, 303, 404, 410
  • Caching

Supported database platforms

  • MySQL
  • Postgres
  • SQLite

Requirements

  • October CMS 3
  • PHP version 8.0.2 or higher.
  • PHP extensions: ext-curl and ext-json.

Supported HTTP status codes

  • HTTP/1.1 301 Moved Permanently
  • HTTP/1.1 302 Found
  • HTTP/1.1 303 See Other
  • HTTP/1.1 404 Not Found
  • HTTP/1.1 410 Gone

Supported HTTP request methods

  • GET
  • POST
  • HEAD

Performance

All redirects are stored in the database and will be automatically "published" to a file which the internal redirect mechanism uses to determine if a certain request needs to be redirected. This is way faster than querying a database.

This plugin is designed to be fast and should have no negative effect on the performance of your website.

To gain maximum performance with this plugin:

  • Enable redirect caching using a "in-memory" caching method (see Caching).
  • Maintain your redirects frequently to keep the number of redirects as low as possible.
  • Try to use placeholders to keep your number of redirect low (less redirects is better performance).

Caching

If your website has a lot of redirects it is recommended to enable redirect caching. You can enable redirect caching in the settings panel of this plugin.

Only cache drivers which support tagged cache are supported. So driver file and database are not supported. For this plugin database and file caching do not increase performance, but can actually have a negative influence on performance. So it is recommended to use an in-memory caching solution like memcached or redis.

How caching works

If caching is enabled (and supported) every request which is handled by this plugin will be cached. It will be stored with tag Vdlp.Redirect.

When you modify a redirect all redirect cache will be invalidated automatically. It is also possible to manually clear the cache using the 'Clear cache' button in the Backend.

Placeholders

This plugin makes advantage of the symfony/routing package. So if you need more info on how to make placeholder requirements for your redirection URLs, please go to: https://symfony.com/doc/current/components/routing/introduction.html#usage

Contribution

Please feel free to contribute to this awesome plugin.

Questions? Need help?

If you have any question about how to use this plugin, please don't hesitate to contact us at [email protected]. We're happy to help you. You can also visit the support forum and drop your questions/issues there.


If you love this quality plugin as much as we do, please rate our plugin.


oc-redirect-plugin's People

Contributors

adrenth avatar bryansmit avatar flusherdock1 avatar juanmarin97 avatar luketowers avatar nathan-van-der-werf avatar sander-beenen avatar sjoerdbe avatar tobias-kuendig avatar verenaroe avatar winitop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

oc-redirect-plugin's Issues

Error with regex

I found an error when a regex reidrect is triggerred:

Method [validateIsRegex] does not exist.

Items are like this:
Target Type: Path or Url
Match Type: Regular Exception
Source Path: /\/acquista$/m .
Target Path or Url: /

All tests are green, but when reidrect is triggerd in real world, I got that error.
Hope this helps!

Redis redirect caching not working

I currently have redis configured as the cache driver for my installation of OctoberCMS running the latest version.

But when I enable the option to cache redirects, all of my redirects stop working.
Screenshot from 2020-04-07 15-01-12

This happens on multiple installs I have of OctoberCMS.

Redirecting from secure www to secure non-www

Hi,

First... we're amazed how incredible this piece of GENIUS is. Thanks so much for making this available.

Not sure if this may be possible with the plugin but we have the following scenario. We have old urls cached in google when our security cert matched urls with https://www.example.com/example-page. With our new site we abandonded www. in favour of https://example.com. So the redirect we want to happen is:

https://www.example.com/example-page --> https://example.com/example-page

However when the user hits https://www. (because it's no longer covered by the cert) the browser warns that the SSL cert is invalid (which we'd expect it to) and connection is not private and doesn't redirect to our non-www url. Is there anything within the plugin that will allow us to redirect in this manner? Tried playing around with advanced settings tab but to no avail I'm afraid.

Any help/tips you can give would be greatly appreciated.

Thanks
Gavin

Redirect middleware not invoked

Hi there,

after update to octobercms (build 465) and redirect plugin 2.0.0 is seems like the RedirectMiddleware is not invoked anymore on my environment (php-7.2 / ubuntu).

Current workaround:

I changed Plugin.php L58 to:

$this->app['Illuminate\Contracts\Http\Kernel']->prependMiddleware(RedirectMiddleware::class);

Anyone else running into this problem?

Redirects with Google Adwords query parameters

As of now the Redirect plugin matches on the URL path AND query parameters:

This is an example:

Redirect: /old-page.php?foo=bar => /new-page/foo-bar (match type: Exact)

/old-page.php?foo=bar [MATCH]
/old-page.php?foo2=bar2 [NO MATCH]
/old-page.php [NO MATCH]

When a site has a Google Adwords campaign running. Incoming requests could be:

/old-page.php?foo=bar&glcid=google-id&key=value

Which results in a [NO MATCH].

Ideally this incoming request should match and adds the ?foo=bar&glcid=google-id&key=value part to the target URL.

Possible solution:

Introduce a new redirect type which does a match on the beginning of the URL.

/old-page.php?foo=bar&glcid=google-id&key=value => /new-page/foo-bar?foo=bar&glcid=google-id&key=value

OR

/old-page.php?foo=bar&glcid=google-id&key=value => /new-page/foo-bar?foo=bar&glcid=google-id&key=value

Trying to access array offset on value of type int

Hi, I have this error : "Trying to access array offset on value of type int" on line 365 of /.../plugins/vdlp/redirect/controllers/Redirects.php
When I click on add redirect...
PHP 7.4 Ocober 464
Thanks.

can't install plugin from CLI

$ ./artisan plugin:install Vdlp.Redirect
Downloading plugin: Vdlp.Redirect
Unpacking plugin: Vdlp.Redirect
Migrating plugin...
Vdlp.Redirect
- v1.0.0:  Transfer vendor ownership. Adrenth.Redirect -> Vdlp.Redirect
- v1.1.0:  Redirect rules are now being cached (if caching enabled) -- See: https://github.com/vdlp/oc-redirect-plugin/issues/1
- v1.2.0:  Add extra filters to the Redirects overview -- See: https://github.com/vdlp/oc-redirect-plugin/pull/5

[Illuminate\Database\QueryException]
SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "vdlp_redirect_redirects" does not exist (SQL: alter table "vdlp_redirect_redirects" add column "ignore_query_parameters" boolean not null default '0')



[Doctrine\DBAL\Driver\PDOException]
SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "vdlp_redirect_redirects" does not exist



[PDOException]
SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "vdlp_redirect_redirects" does not exist

White spaces in redirects.csv

i had troubles getting the redirect plugin up and running. My environment is:

  • Octobercms build 465
  • PHP 7.2 / ubuntu
  • Plugin version 2.0.0 (1.10.5 as well)

The reason is that PublishManager.publishToFilesystem() writes white spaces for redirect entries.

id,match_type,target_type,from_scheme,from_url,to_scheme,to_url,cms_page,static_page,status_code,requirements,from_date,to_date,ignore_query_parameters
1,"exact       ","path_or_url ","auto ",/test/abc,"auto ",/test#abc,,,302,[],,,1

The scheme "exact " is not matched against "exact" or "auto" afterwards and the redirect is ignored.

A possible workaround might be to add these lines of code to PublishManager L 93:

foreach ($row as $key => $value) {
  if (is_string($key) && is_string($value)) {
    $row[$key] = trim($value);
  }
}

But it seems to be a workaround. I did not get the reason why the values contain spaces.

Maybe you have a clue?

Thanks

A syntax error was detected in... version.yaml

I meet this error when logging in to the backend, and on updating plugins:

A syntax error was detected in /home/admin/web/domain.com/public_html/plugins/vdlp/redirect/updates/version.yaml. Unable to parse at line 35 (near " - 20190704_0007_add_timestamp_crawler_index_on_clients_table.php") at line 38 (near "/home/admin/web/domain.com/public_html/vendor/october/rain/src/Parse/Yaml.php").

Apache .htaccess export

Hello,

I really like the idea of your plugin, but I have doubts about its performance versus Apache RewriteRule directives in .htaccess

How hard would it be to add a mode where the plugin would be used solely for maintaining rules and writing those as RewriteRules to the ".htaccess" file?

Thanks.

Regex as new Match Type

It would be very helpful if there could be a way to input regular expressions as Source Path to minimize duplicates.

Some examples:

  • /about and /about/ could be combined to \/about\/?
  • /cookiebanner.css and /cookiebanner.js could be combined to \/cookiebanner\.(js|css)

At the moment I need 4 rules for these examples and with all the other rules I have it is a bit messy.
Regular expressions would fix this and help to keep everything tidy ;)

resolve helper does not return expected class

Here:

https://github.com/vdlp/oc-redirect-plugin/blob/develop/updates/20180718_0001_create_tables.php#L29

And here:

https://github.com/vdlp/oc-redirect-plugin/blob/develop/updates/20180831_0002_upgrade_from_adrenth_redirect.php#L27-L30

Results in a Call to a member function getSchemaBuilder() on string exception for me, when installing the plugin.

Strangely, resolve('db') just returns a db string, but not the concrete implementation. Changing it to app('db') solves this problem.

Is there a reason you don't simply use the DB and Log facades in these cases?

Laravel Framework 5.5.48
October CMS Build 458
Vdlp.Redirect 1.10.2

Provide event listener to auto-register redirects

I really like the feature where changing a page's url creates a redirect rule.

Would it be possible to provide this feature to other plugins as well? Maybe through an event?

// Changed custom plugin model slug
Event::fire('vdlp.redirect.url', ['old-slug', 'new-slug']);

What additional data would be needed to cover all your redirect options (fixed string, cms page reference, etc)

What do you think?

Error on create redirect page on php 7.4.2

I get an error on the redirect creation page:

"Trying to access array offset on value of type int" on line 365 of /Users/uuu/fff/ttt/plugins/vdlp/redirect/controllers/redirects.php

PHP 7.4.2
October 464

Regex problem

I just installed the plugin and tried to create a new redirect using regex. I followed the example and as a source path I used /\/contact\/?/ and for the target path it was simply /contact-us

It accepted it as a valid regex but when I then tried to visit www.mysite.com/contact I was presented with an error message Call to a member function send() on null after it redirected.

Using an exact match for /contact and /contact-us works as expected with no error.

Is it possible for you to allow users to choose the CRON Job run time please

Hi,

Is it possible for you to allow users to choose the CRON Job run time please.

See code line:

$schedule->command('vdlp:redirect:publish-redirects')->daily();

If possible something like an option in the settings where we can choose any 30 minute interval.

The reason to ask is because I have over a dozen plugins all trying to run the CRON Jobs at midnight and I want to space them throughout the day to be kinder to the server's cpu.

Also is it possible to escape a few things, for example:

'label' => trans('vdlp.redirect::lang.statistics.top_redirects_this_month', ['top' => 10]),

Could be re-written as:

'label' => e(trans('vdlp.redirect::lang.statistics.top_redirects_this_month', ['top' => 10])),

There are a few more in the plugin missing escape protection.

Thanks in advance.

Ability for Dynamic Redirects Like CloudFlare Page Rules

This is such a killer plugin! The only thing it seems to be missing that we can't retire CloudFlare Page Rules is the ability have a shortened URL redirect while keeping a dynamic modifier at the end.

For example, having a simple url like "company.com/meet/2019-08-12" and having the 2019-08-12 exist/stay at the end of the destination URL as you can see in this screenshot:

Image 2019-09-01 at 10 21 57 PM

CloudFlare simply has it so that an asterisk in the Source Path (company.com/meet/*) allows you to have a destination URL and $1 will split out into the Target URL whatever the * data was in the Source Path.

Is there a way to do this currently? Maybe using "Regular Expression" or something?

If not, are there any plans to add this functionality?

Thanks so much!
Alex

Log-bombing with update messages

Plugin version: 2.0.1, CMS version: 465

Last update started flooding event log with "Vdlp.Redirect: Redirect engine has been updated with N redirects." - it looks like every successful redirection hit writes this informational entry to the OctoberCMS Event log.

I have 4 redirects, two start with the same string.

In frontend when it try to add Redirect Log it can not find validator `is_regex`

issue caused StatisticsHelper::increaseHitsForRedirect called from frontend

at that time $redirect->update cause validation for Redirect modal and it get bad-method exception

because for frontend is_regex validation is not exist because of condition !App::runningInBackend()) stops flow further and Validator::extend('is_regex' never executed for Frontend

Solution would be move -

/*
         * Custom validators.
         */
        Validator::extend('is_regex', static function ($attribute, $value) {

before condition so it also available in frontend.

if (!App::runningInBackend()) {

Plugin.php

if additional information needed please let me know.

SQLite index conflict when upgrading from Adrenth.Redirect

Migrations fail when upgrading from Adrenth.Redirect while SQLite is in use.

The migrations trip up where indexes are created with explicit names because they've already been defined in the Adrenth.Redirect tables.

A workaround would be to drop those conflicted indexes before running october:up:

$ sqlite3 storage/database.sqlite

 > DROP INDEX redirect_dmy;
 > DROP INDEX redirect_my;
 > DROP INDEX redirect_log_dmy;
 > DROP INDEX redirect_log_my;
 > DROP INDEX month_year;
 > .quit

$ php artisan october:up

Laravel namespaces things appropriately when a specific index name isn't defined. I'm not sure if it'd be worth dropping those from the existing migrations. I'm guessing those indexes may be referenced by name somewhere...

Regardless, I thought posting a workaround may be helpful to other developers.

Hit 30d graph improvements

Make a distinction between the hits by user/session and crawlers.
Probably a new graphing SDK package needed to achieve this.

Redirects stop working with caching enabled

I've created a redirect using a placeholder.
target type: path or url
source: /assets?c={c}&a={a}
target: /assets/{c}/{a}

When I have caching enabled, the redirects works a few times and then returns 404.
When I have caching disabled, the redirect works.

plugin version 1.9.0

Automatic creation of page redirects is annoying

When I rename a CMS page, this plugin automatically creates a redirect for it. Usually, this is unnecessary, and often results redirect loops or broken URLs depending on how I rename pages. When Adrenth was developing this plugin, I believe I also raised the same issue. I think a backend settings option to disable this automatic creation would be better, more so if it was opt-in. I spent more time trying to figure out if it was my web browser, web server, or October that was broken before I found the automatically created redirects.

Redirect loop when auto creating redirects

A user reported this issue.

Create a page with URL /test
Modify this page URL to /test2
Modify this page URL to /test

A redirect loop occurred.

This issue needs some more investigation.

Last hit date by crawler/user session

For each redirect display the date when it last was hit. This data is present in the vdlp_redirect_clients table. This can be splitted to two dates:

  • The date this redirect was last hit by a crawler
  • The date this redirect was last hit by a user/session

Type error in RedirectManager::matchExact()

Today I found the following Error in my Event-Log:

Raw Stack-Trace:

Symfony\Component\Debug\Exception\FatalThrowableError: Type error: Argument 2 passed to Vdlp\Redirect\Classes\RedirectManager::matchExact() must be of the type string, null given, called in /webroot/plugins/vdlp/redirect/classes/RedirectManager.php on line 379 in /webroot/plugins/vdlp/redirect/classes/RedirectManager.php:397
Stack trace:
#0 /webroot/plugins/vdlp/redirect/classes/RedirectManager.php(379): Vdlp\Redirect\Classes\RedirectManager->matchExact(Object(Vdlp\Redirect\Classes\RedirectRule), NULL)
#1 /webroot/plugins/vdlp/redirect/classes/RedirectManager.php(120): Vdlp\Redirect\Classes\RedirectManager->matchesRule(Object(Vdlp\Redirect\Classes\RedirectRule), NULL, 'https')
#2 /webroot/plugins/vdlp/redirect/classes/RedirectMiddleware.php(53): Vdlp\Redirect\Classes\RedirectManager->match('//xmlrpc.php?rs...', 'https')
#3 /webroot/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Vdlp\Redirect\Classes\RedirectMiddleware->handle(Object(Illuminate\Http\Request), Object(Closure))
#4 /webroot/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#5 /webroot/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#6 /webroot/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#7 /webroot/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#8 /webroot/index.php(43): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#9 {main}

access.log:
"GET //xmlrpc.php?rsd HTTP/1.1" 500

redirect doesn't work

  1. a rule to redirect is not being saved if selected either CMS or Static page
  2. schema is not being fetched properly and not visible on respective setting's tab
  3. redirect doesn't work for exact match even after clearing views/cache

october:latest
plugin: latest
db: postgres11.5
host for testing: http://localhost:33333

"Call to a member function send() on null" on '/' route

Hi,

Just after install plugin, '/' always generate this error.
I tried to move my homepage to another route ('/home') and it has worked.

Why I had to disable '/' route to fix it? I'd like understand.
If it should not be enabled, why was it enabled by default after install? Is this a special case?

Thanks

  • PHP: 7.2
  • OctoberCMS build: 458
  • Other plugins: RainLab.Translate 1.6.2, RainLab.User 1.5.0, RainLab.Builder 1.0.26
  • OctoberCMS is on subdir, not to root of domain.

Error when running TestLab on PHP 7.0

Getting the following error when running TestLab on all enabled redirects on a PHP 7.0 environment:

Symfony\Component\Debug\Exception\FatalThrowableError: Type error: Argument 1 passed to Vdlp\Redirect\Classes\RedirectManager::__construct() must be an instance of Illuminate\Http\Request, none given, called in /plugins/vdlp/redirect/classes/TesterBase.php on line 124 in /plugins/vdlp/redirect/classes/RedirectManager.php:94

Stack trace:

#0 /plugins/vdlp/redirect/classes/TesterBase.php(124): Vdlp\Redirect\Classes\RedirectManager->__construct()
#1 /plugins/vdlp/redirect/classes/testers/RedirectMatch.php(28): Vdlp\Redirect\Classes\TesterBase->getRedirectManager()
#2 /plugins/vdlp/redirect/classes/TesterBase.php(56): Vdlp\Redirect\Classes\Testers\RedirectMatch->test()
#3 /plugins/vdlp/redirect/controllers/TestLab.php(210): Vdlp\Redirect\Classes\TesterBase->execute()
#4 /plugins/vdlp/redirect/controllers/TestLab.php(122): Vdlp\Redirect\Controllers\TestLab->getTestResults(Object(Vdlp\Redirect\Models\Redirect))
#5 [internal function]: Vdlp\Redirect\Controllers\TestLab->index_onTest()
#6 /modules/backend/classes/Controller.php(612): call_user_func_array(Array, Array)
#7 /modules/backend/classes/Controller.php(470): Backend\Classes\Controller->runAjaxHandler('onTest')
#8 /modules/backend/classes/Controller.php(267): Backend\Classes\Controller->execAjaxHandlers()
#9 /modules/backend/classes/BackendController.php(165): Backend\Classes\Controller->run('index', Array)
#10 [internal function]: Backend\Classes\BackendController->run('vdlp/redirect/t...')
#11 /vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array(Array, Array)
#12 /vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction('run', Array)
#13 /vendor/laravel/framework/src/Illuminate/Routing/Route.php(212): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Backend\Classes\BackendController), 'run')
#14 /vendor/laravel/framework/src/Illuminate/Routing/Route.php(169): Illuminate\Routing\Route->runController()
#15 /vendor/laravel/framework/src/Illuminate/Routing/Router.php(658): Illuminate\Routing\Route->run()
#16 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#17 /modules/backend/classes/BackendController.php(68): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#18 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(131): Backend\Classes\BackendController->Backend\Classes\{closure}(Object(Illuminate\Http\Request), Object(Closure))
#19 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#20 /vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#21 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))
#22 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#23 /vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#24 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#25 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#26 /vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(63): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#27 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#28 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#29 /vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#30 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#31 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#32 /vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(66): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#33 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#34 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#35 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#36 /vendor/laravel/framework/src/Illuminate/Routing/Router.php(660): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#37 /vendor/laravel/framework/src/Illuminate/Routing/Router.php(635): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#38 /vendor/laravel/framework/src/Illuminate/Routing/Router.php(601): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))
#39 /vendor/october/rain/src/Router/CoreRouter.php(20): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#40 /vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): October\Rain\Router\CoreRouter->dispatch(Object(Illuminate\Http\Request))
#41 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#42 /vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(46): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#43 /vendor/october/rain/src/Foundation/Http/Middleware/CheckForMaintenanceMode.php(24): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#44 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): October\Rain\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#45 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#46 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#47 /vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#48 /vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#49 /index.php(43): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#50 {main}

Problem with Laravel 6 upgrade

In testing this plugin with the Laravel 6 upgrade branch I've run into the issue

"Vdlp.Redirect: Could not load redirect rules: Call to undefined method League\Csv\Reader::fetchAssoc()".

This is probably because the Laravel 6 upgrade has switched to league/csv v9 instead of the current v8. Ping me if you'd like me to look into this further.

Error while redirecting

Every time someone is redirected the following error occurs and the redirect fails:

Illuminate\Contracts\Container\BindingResolutionException: Unresolvable dependency resolving [Parameter #0 [ <required> $app ]] in class Illuminate\Database\DatabaseManager in /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:933
Stack trace:
#0 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(871): Illuminate\Container\Container->unresolvablePrimitive(Object(ReflectionParameter))
#1 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(812): Illuminate\Container\Container->resolvePrimitive(Object(ReflectionParameter))
#2 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(780): Illuminate\Container\Container->resolveDependencies(Array)
#3 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(631): Illuminate\Container\Container->build('Illuminate\\Data...')
#4 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(586): Illuminate\Container\Container->resolve('Illuminate\\Data...', Array)
#5 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(732): Illuminate\Container\Container->make('Illuminate\\Data...', Array)
#6 /var/www/vendor/october/rain/src/Foundation/Application.php(162): Illuminate\Foundation\Application->make('Illuminate\\Data...')
#7 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(110): October\Rain\Foundation\Application->make('Illuminate\\Data...', Array)
#8 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(739): app('Illuminate\\Data...')
#9 /var/www/plugins/vdlp/redirect/classes/StatisticsHelper.php(230): resolve('Illuminate\\Data...')
#10 /var/www/plugins/vdlp/redirect/classes/RedirectManager.php(174): Vdlp\Redirect\Classes\StatisticsHelper->increaseHitsForRedirect(1)
#11 /var/www/plugins/vdlp/redirect/classes/RedirectMiddleware.php(59): Vdlp\Redirect\Classes\RedirectManager->redirectWithRule(Object(Vdlp\Redirect\Classes\RedirectRule), '/cookie-policy')
#12 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Vdlp\Redirect\Classes\RedirectMiddleware->handle(Object(Illuminate\Http\Request), Object(Closure))
#13 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#14 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#15 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#16 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#17 /var/www/index.php(43): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#18 {main}

Version Number: 1.4.2

Rules path is not readable

Hi,

thank you for this promising plugin! just installed it locally, this is what I get now with every page load:

Vdlp\Redirect\Classes\Exceptions\RulesPathNotReadable: Rules path /Users/milo/Sites/wg/storage/app/redirects.csv is not readable. in /Users/milo/Sites/wg/plugins/vdlp/redirect/classes/exceptions/RulesPathNotReadable.php:22

I didn't create any redirect rules until now, I think this is not intended?
Thank you!

Redirection type 410[Gone] results in 404[Not Found]

Hey Alwin,

Noticed that if I choose "410" redirect to indicate the url is gone, I get a 404 not found in google chrome network developer tools and my 404 template appears. Is there something I'm missing in order to get a 410 status response?

Many thanks!
Gavin

Error while generating sparkline images

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column '[database].vdlp_redirect_clients.timestamp' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by in

Query parameters only ignored in tests

If I check "Ignore query parameters (recommended)." the tests say that it will redirect me. But if I save it and try it by accessing the url that should be redirected, it only works if I don't add any query parameters...

Used Version: 1.4.3

Support multi server environments

Reported by @pfyod:

We are running OctoberCMS on multiple servers. Unfortunately, this plugin does not really support this deployment scenario out of the box, as it caches redirect rules inside the hardcoded 'app/redirects.csv' file. One can fiddle with NFS / inotify + rsync / etc to distribute this file between nodes, but I don't believe that it's an optimal solution.

There are obviously multiple ways how this can be implemented:

  • Automatically publish the 'app/redirects.csv' if file modification date is older than the newest change in the database (requires a DB query inside RedirectManager::loadRedirectRules);
  • Allow publishing into cache instead of the 'app/redirects.csv'. That way one can have a centralized / clustered / replicated Redis setup and cache rules get automatically shared between servers;
  • Allow disabling 'app/redirects.csv' altogether to always read redirect rules from the database.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.