Question

I want to redirect all http request to one file controller.php

# My .htaccess
RewriteCond %{REQUEST_URI}  !\.(.+)$
RewriteRule ^(.*)([^/])$ http://%{HTTP_HOST}/$1$2/ [L,R=301]
RewriteRule ^([a-zA-Z0-9_-]+)$      controller.php

Consider this request http://mysite.com/en-US/messages/new/
I have php script to get all url parameters and treat them
controller.php is been displayed but a 404 response code is sent too by Apache.

How can I make a good rewrite rule to prevent 404 response ?

Was it helpful?

Solution

You regex doesn't include / characters.

RewriteRule ^([a-zA-Z0-9_-/]+)$      controller.php
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top