I have a directory called "public_html/hammer/" (my CMS). I want to use the image folder that is on the root "public_html/". I could simply do something like "../picture.jpg" but the content within "/hammer/" will be show on the root directory so it will then be broken when I query the html.
How can I write an ModRewrite or similar that will point "public_html/hammer/images/" to "public_html/images"?
Assuming public_html is your document root, place a rule like the following in public_html/.htaccess
:
RewriteEngine On
RewriteRule ^hammer/images/(.*)$ images/$1 [L]
Basically:
RewriteEngine on
RewriteRule ^.*$ ../../$1 [L]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.