Reputation: 53
I have this on my htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]
</IfModule>
And in the index.php I get the REQUEST_URI so I can know what page to display.
But I have another files .php, how to make that all php execution like http://domain.com/file.php directs to index.php?
If I the line "RewriteCond %{REQUEST_FILENAME} !-f" then the sitemap.xml is not working.
Sorry for my bad english, and thanks for your help!
Upvotes: 1
Views: 389
Reputation: 785581
You can have it like this:
<IfModule mod_rewrite.c>
RewriteEngine On
# route all *.php to /index.php
RewriteCond %{THE_REQUEST} \s/+(.+?)\.php[/\s?] [NC]
RewriteRule !^index\.php$ index.php [L,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]
</IfModule>
Upvotes: 1