Jump to content

Friendly URLs include index.php with my .htaccess


Go to solution Solved by Matt,

Recommended Posts

2 hours ago, Jim M said:

Could you please provide the image/video you're attempting to share?

Any Youtube Video, for example this:

And any image.

This error is only with this code in htaccess

RewriteCond %{THE_REQUEST} \ /(.+/)?index\.([^/]+)(\?.*)?\  [NC]
RewriteRule ^(.+/)?index\.([^/]+)$ /%1 [NC,R=301,L]

That works for remove index.php in the URL, but create problems embed videos and images:

Quote

The link could not be embedded because of an unexpected error: forbidden. The CSRF protection key did not match. This may indicate a plugin or theme is out of date. Please contact technical support for more information.

 

Link to comment
Share on other sites

14 hours ago, pequeno said:

Any Youtube Video, for example this:

And any image.

This error is only with this code in htaccess

RewriteCond %{THE_REQUEST} \ /(.+/)?index\.([^/]+)(\?.*)?\  [NC]
RewriteRule ^(.+/)?index\.([^/]+)$ /%1 [NC,R=301,L]

That works for remove index.php in the URL, but create problems embed videos and images:

 

If its only when you have that in the code, you would need to remove it, as that isnt our code there. I have added notes to this ticket so we can get clarification from our developers on whether or not it should be redirecting when visiting index.php directly

Link to comment
Share on other sites

38 minutes ago, Marc Stridgen said:

If its only when you have that in the code, you would need to remove it, as that isnt our code there. I have added notes to this ticket so we can get clarification from our developers on whether or not it should be redirecting when visiting index.php directly

Thank you. Because the real problem is the redirection of index.php with your code.

Can I add my redirects to htaccess now? It seems that this does not affect your code.

Link to comment
Share on other sites

Hello.

Using thus code:

RewriteRule (.*) /index.php/$1 [L]

instead of:

RewriteRule . /index.php [L]

It seems to work correctly removing index.php  and I don't get the error:

Quote

The link could not be embedded because of an unexpected error: forbidden. The CSRF protection key did not match. This may indicate a plugin or theme is out of date. Please contact technical support for more information.

Now, the code in htaccess is.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /index.php/$1 [L]

I will verify that it does not give problems and I will keep you informed.

Link to comment
Share on other sites

  • 3 weeks later...
On 12/25/2021 at 1:24 AM, pequeno said:

Hello.

Using thus code:

RewriteRule (.*) /index.php/$1 [L]

instead of:

RewriteRule . /index.php [L]

It seems to work correctly removing index.php  and I don't get the error:

Now, the code in htaccess is.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /index.php/$1 [L]

I will verify that it does not give problems and I will keep you informed.

Sorry! After checking a few days, don´t remove index.php from my URL

1 minute ago, pequeno said:

Sorry! After checking a few days, don´t remove index.php from my URL

 

On 12/21/2021 at 11:46 AM, Marc Stridgen said:

If its only when you have that in the code, you would need to remove it, as that isnt our code there. I have added notes to this ticket so we can get clarification from our developers on whether or not it should be redirecting when visiting index.php directly

Please, can you check it ?

Thanks.

Edited by pequeno
Link to comment
Share on other sites

  • Management
  • Solution

I'm reviewing this for you.

I would suggest restoring the default .htaccess file which can be downloaded via ACP > Search Engine Optimisation > Friendly URLs (the link is in the description of the setting 'Rewrite URLs'.

invisioncommunity.com/ and invisioncommunity/index.php will both load without a redirect. The htaccess file looks for files that do not exist and rewrite based on that. index.php does exist, so this will not be rewritten or redirected.

https://invisioncommunity.com/forums/index.php is not a real page and there is not a friendly routing path of that specific URL. /forums/ is a "fake" directory itself.

Likewise https://invisioncommunity.com/forums/topic/index.php is not a real page and will result in an error page.

I think the software is working as expected for you.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...