Reputation: 31
I have files on my Apache webserver with names like "index.cfm?PageID=30
" where ?PageID=30
is a part of the actual filename. How can I set up .htaccess
to make Apache open these files correctly without using PageID
as URL parameters?
I use try_files $uri $uri$args
for similar issues in Nginx, but I'm new with Apache.
Same for files like "news.asp?sec=news&article=24
".
I just need to 200 OK (with content of file /var/example/news.asp?sec=news&article=24
) when I ask for page example.com/news.asp?sec=news&article=24
.
Upvotes: 1
Views: 70
Reputation: 31
I have found the correct code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{ENV:REDIRECT_STATUS} !200
RewriteCond %{QUERY_STRING} !^$
RewriteRule ^(.*)$ /$1\%3F%{QUERY_STRING} [L,NE]
</IfModule>
You can check how it works mt website. For example http://www.drugeducationforum.com/index.cfm?PageID=30
Where index.cfm?PageID=30
is a full name of the file.
Upvotes: 1