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?
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
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.
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
RewriteRule ^index.php/?(.*)$ $1 [R=301,L]
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>
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community