Mobile app version of vmapp.org
Login or Join
Steve110

: Apache rewrite rule to add a directory in front of a file I have an HTML page in my root directory, and when someone clicks it I'd like there to be a directory before the file name, that

@Steve110

Posted in: #ModRewrite #Seo #Url #UrlRewriting

I have an HTML page in my root directory, and when someone clicks it I'd like there to be a directory before the file name, that doesn't exist.

For example, instead of just being able to access:


wwww.example.com/link.html


This would also work:


wwww.example.com/folder/link.html


Can this be done with a rewrite rule?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Steve110

1 Comments

Sorted by latest first Latest Oldest Best

 

@Heady270

Your rewrite rule (appropriate for a .htaccess file) would look like this:

RewriteRule ^folder/link.html$ /link.html


That would serve the contents of link.html at both /link.html and /folder/link.html.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme