Jump to content

Friendly URLs include index.php with my .htaccess


Go to solution Solved by Matt,

Recommended Posts

Posted
29 minutes ago, Jim M said:

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

Can you specify a little more? I do not understand what I should share.

Posted
5 minutes ago, pequeno said:

Can you specify a little more? I do not understand what I should share.

Sorry, the image/video URL which you're attempting to share/embed here that the error you mentioned comes from.

Posted
1 hour ago, Jim M said:

Sorry, the image/video URL which you're attempting to share/embed here that the error you mentioned comes from.

Thanks Jim M.

No error. Simply that the redirects do not remove index.php in the url as I indicated in my first post.

Posted
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.

 

Posted
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

Posted
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.

Posted

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.

  • 3 weeks later...
Posted (edited)
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
  • Management
  • Solution
Posted

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.

  • Recently Browsing   0 members

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