This is what my .htaccess file looks like:
# Original
# If you modify this file then change the above line to: # Modified
<IfModule mod_rewrite.c>
RewriteEngine On
# Certain hosts may require the following line.
# If vanilla is in a subfolder then you need to specify it after the /.
# (ex. You put Vanilla in /forum so change the next line to: RewriteBase /forum)
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php\?p=$1 [QSA,L]
</IfModule>
I just read that with rewrite rules in .htaccess, I can create URL aliases, which can be used to shorten long URLs. I want to create a wildcard rewrite rule so that all the files in this directory: http://example.com/cache/Sitemaps/ are shortened (not redirected) to http://example.com/*.
For example, if file1.xml, file2.xml, file3.xml… and so on are files residing in http://example.com/cache/Sitemaps/, I want:
http://example.com/cache/Sitemaps/file1.xml → http://example.com/file1.xml
http://example.com/cache/Sitemaps/file2.xml → http://example.com/file2.xml
http://example.com/cache/Sitemaps/file3.xml → http://example.com/file3.xml
…and so on! (where → stands for ‘aliases or shortened to’)
How do I do this? And where should I add it in my .htaccess file (shown above)? Thanks.
Here is your modified .htaccess, place it in DOCUMENT_ROOT itself: