nystudio107 / craft-retour

Retour allows you to intelligently redirect legacy URLs, so that you don't lose SEO value when rebuilding & restructuring a website
https://nystudio107.com/plugins/retour
Other
38 stars 26 forks source link

404 data & redirect additions not displaying in control panel #293

Closed mediagirl closed 8 months ago

mediagirl commented 8 months ago

Describe the bug

I just installed the plugin on a new project and it is not functioning correctly.

Specifically, it is not displaying 404 data and not displaying Redirects that I've added.

I see the 404 and redirect data in the database tables, but nothing is displaying in the control panel.

Here's a screen recording: https://www.screenpresso.com/=7u42c

Versions

mediagirl commented 8 months ago

I applied all Craft updates and was able to get Retour working in my local dev environment which runs PHP 8.1.19, but I'm seeing the same issues in production after applying the updates. Production is running PHP 8.1.2.

khalwat commented 8 months ago

So when you're on the Retour Dashboard or Redirects pages, view the developer console in your web browser. I suspect you might see some errors listed there.

If you could copy them and paste them in here that'd be helpful.

mediagirl commented 8 months ago

Yes, I'm seeing numerous errors in the console. I'm including two errors below which seem to be repeated over and over.

NOTE 1: I replaced the real domain name with "DOMAIN" in the errors below.

NOTE 2: My Craft settings set the domain name specifically with HTTPS. I double checked that. I don't know why the url is being called by the plugin using HTTP.

NOTE 3: I manually deleted the "cpresources" directory to force a rebuild to see if something was corrupted but the issue persists.

Blocked loading mixed active content “http://www.DOMAIN.com/?p=cm/actions/retour/charts/dashboard&range=month&siteId=0

Object { stack: "ee@https://www.DOMAIN.com/cpresources/e877cd4d/assets/vue-apexcharts-trtDL0ol.js:1:5378\nxs</</W.onerror@https://www.DOMAIN.com/cpresources/e877cd4d/assets/vue-apexcharts-trtDL0ol.js:3:4588\n", message: "Network Error", name: "AxiosError", code: "ERR_NETWORK", config: {…}, request: XMLHttpRequest }

mediagirl commented 8 months ago

I went through a process of elimination with the .htaccess file and found removing this code gets the Retour dashboard loading correctly. I removed the code from the .htaccess file for now and will dig in that direction. This is code that's in my boilerplate .htaccess file for Craft projects and seems like it's no longer needed.

    # Removed index.php
    RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
    RewriteCond %{REQUEST_URI} !^/index\.php/cm\b [NC] # Don't mess with admin requests
    RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]
khalwat commented 8 months ago

Yeah something isn't right with your rewrite rules, causing it to load over http when it needs to be https