Reputation: 963
I'd like to remove the ".php" at the end of all webpages AND rewrite my dynamic urls for the section "example.com/archive?url=..."
What I got so far:
Options -MultiViews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
This part works fine but now I also want to rewrite my dynamic urls for the following section of the website.
Old url: example.com/archive?url=test-article
New url: example.com/archive/test-article
RewriteRule ^archive/([^/]+)$ archive?url=$1
This part doesn't work. What am I missing here?
It's used for an addon domain so maybe this has something to do with the problem?
EDIT 1:
I put some garbage in my .htaccess file and it generates an error so I know for sure it's reading the file.
EDIT 2:
I disabled multiviews as proposed below but getting an internal server error now. This is the error log:
[Tue May 20 13:12:12 2014] [error] [client (ip)] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace
Edit 3: I found the solution
I solved the problem by changing the last rule into:
RewriteRule ^news/([^/]+)$ archive?url=$1
Upvotes: 2
Views: 159
Reputation: 785156
Most likely you have options MultiViews
enabled.
You can disable that using:
Options -MultiViews
With MultiViews
disabled it will not not serve /file.php
when you request /file
.
EDIT: As per your revised question you can do:
RewriteRule ^news/([^/]+)$ archive?url=$1
Upvotes: 1