I do an experiment and found a trick like rewrite any URL to be handled as php
1st step
make htacces for ignore file extension and folder
2nd step
create a function to handle your rewrite URL in your index.php
eg.
you want have dinamic sitemap URL in your robots.txt
add this script in 1st line of your index.php
or
the content of robots.php like script above
you can do it for other filetype, just replace header content-type with MIME type of your file
other example for image file
open a gif image in notepad then copy it
note: this trick only work if you not have the real file with name in that script
1st step
make htacces for ignore file extension and folder
Code:
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
2nd step
create a function to handle your rewrite URL in your index.php
eg.
you want have dinamic sitemap URL in your robots.txt
add this script in 1st line of your index.php
PHP:
if($_SERVER['REQUEST_URI'] == '/robots.txt') {
header("Content-type:text/plain");
echo "User-agent: *\r\nDisallow: /images/\r\n\r\nSitemap: http://yourdomain.com/sitemap-".date('d').".xml"; exit;
}
PHP:
if($_SERVER['REQUEST_URI'] == '/robots.txt') {
include('robots.php'); exit;
}
you can do it for other filetype, just replace header content-type with MIME type of your file
other example for image file
open a gif image in notepad then copy it
PHP:
if($_SERVER['REQUEST_URI'] == '/image.gif') {
header("Content-type:image/gif");
echo "paste from notepad in here"; exit;
// or echo string from file_get_contents the image
}
note: this trick only work if you not have the real file with name in that script