Is there a way to get Apache to serve files with a question mark in their name?

I cleared a bunch of pages using wget -m -k -E. The resulting files have names in the form foo.php? Bar.html. Apache all guesses after? this is a query string, is there any way to tell her to ignore? as a query string delimiter (and see foo.php? bar.html as the requested file, not foo.php)?

To save you a trip to wget manpage:
-m: mirror recursively
-E: foo.php? Bar becomes foo.php? Bar.html
-k: convert links on pages (foo.php? Bar now refers to foo.php? Bar.html inside all pages so that they display correctly)

+5
source share
2 answers

? % 3F ?

+4

Apache v1 , v2 .

mod_rewrite. :

RewriteEngine On 

# Convert ? -> %3F in queries and add .html to the end of the filename
RewriteCond %{ENV:REDIRECT_STATUS} !200 
RewriteCond %{QUERY_STRING} !^$ 
RewriteRule ^(.*)$ /$1\%3F%{QUERY_STRING}.html [L,NE]

# An addition for *.php files without question mark in its name, adding html to the end of the filename
RewriteRule ^(.*?)\.php$ $1.php.html
+3

All Articles