Support the ongoing development of Laravel.io →
Configuration Requests Input
Last updated 7 months ago.
0

Let me understand... You imported some mod_rewrite rules inside IIS and now the site works either with and without "index.php", is that right? Well, that's the usual behavior. So, what do you want the webserver to do when it first receives a request with "index.php"? Do you want it to send a redirect to the same url without "index.php"? Or do you want it to send an HTTP error code with error message?

Last updated 7 months ago.
0

popolla said:

Let me understand... You imported some mod_rewrite rules inside IIS and now the site works either with and without "index.php", is that right? Well, that's the usual behavior. So, what do you want the webserver to do when it first receives a request with "index.php"? Do you want it to send a redirect to the same url without "index.php"? Or do you want it to send an HTTP error code with error message?

I want to redirect to a route without index.php

Last updated 7 months ago.
0

With Apache you would use the R flag.
You can try adding something like this before the other rewrite rules (to be left untouched):

RewriteRule ^index\.php/(.*)$ $1 [R=301,L]

That may require some tuning, please search the web.

Last updated 7 months ago.
0

popolla said:

With Apache you would use the R flag.
You can try adding something like this before the other rewrite rules (to be left untouched):

RewriteRule ^index.php/(.*)$ $1 [R=301,L]

That may require some tuning, please search the web.

Great, this almost fixes the whole problem.

It redirects domain.com/index.php/my/page to domain.com/my/page but I'd also want to redirect domain.com/index.php to domain.com/ without the index.php

Last updated 7 months ago.
0
RewriteRule ^index.php/?(.*)$ $1 [R=301,L]
Last updated 7 months ago.
0

popolla said:

RewriteRule ^index.php/?(.*)$ $1 [R=301,L]

Thanks a lot for this one!

In IIS it is

<rewrite>
  <rules>
    <rule name="Imported Rule 1" stopProcessing="true">
      <match url="^index.php/?(.*)$" ignoreCase="false" />
      <action type="Redirect" redirectType="Permanent" url="{R:1}" />
    </rule>
  </rules>
</rewrite>
Last updated 7 months ago.
0

Sign in to participate in this thread!

LaraJobs

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.