Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3595202
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T19:49:16+00:00 2026-05-18T19:49:16+00:00

how to rewrite urls for images and other static files to specific folder, i.e.

  • 0

how to rewrite urls for images and other static files to specific folder, i.e. I am using this so far:

RewriteRule \.(woff|ttf|svg|js|ico|gif|jpg|png|css|htc|xml|txt)$ /MyFolder/$1

but its not working,

please help.

——————- update ———————

ok so now I have:

RewriteCond %{HTTP_HOST} ^(www.)?exmpale.com$
RewriteCond %{REQUEST_URI} !^/exmpale.com/
RewriteRule ^(.*\.(woff|ttf|svg|js|ico|gif|jpg|png|css|htc|xml|txt))$ /exmpale.com/$1

RewriteCond %{HTTP_HOST} ^(www.)?exmpale.com$
RewriteRule !\.(woff|ttf|svg|js|ico|gif|jpg|png|css|htc|xml|txt)$ /exmpale.com/index.php

so images redirected to exmpale folders work but now I would like to rewrite everything else to index.php, above solution is not working so far.

cheers,
/Marcin

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T19:49:17+00:00Added an answer on May 18, 2026 at 7:49 pm

    Maybe this is what you want:

    RewriteRule ^(.*\.(woff|ttf|svg|js|ico|gif|jpg|png|css|htc|xml|txt))$ /MyFolder/$1
    

    or perhaps this:

    RewriteRule ([^/]*\.(woff|ttf|svg|js|ico|gif|jpg|png|css|htc|xml|txt))$ /MyFolder/$1
    

    If neither of those is what you’re looking for please add details with some examples of your desired inputs/outputs.

    As for your update, you probably want to use the L flag to stop rule processing when this rule matches. eg:

    RewriteCond %{HTTP_HOST} ^(www.)?exmpale.com$
    RewriteCond %{REQUEST_URI} !^/exmpale.com/
    
    # The next line is long. Scroll to the end!
    RewriteRule ^(.*\.(woff|ttf|svg|js|ico|gif|jpg|png|css|htc|xml|txt))$ /exmpale.com/$1 [L]
    
    RewriteCond %{HTTP_HOST} ^(www.)?exmpale.com$
    RewriteRule .* /exmpale.com/index.php
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using .htaccess to rewrite my URLs and so far it's almost working as
I am using Apache as a web server to rewrite urls. The pattern is
Ok, this is driving me nuts... I'm trying to rewrite my urls like this:
I use the below mod rewrite code for urls like: www.site.com/play/543 RewriteEngine On RewriteRule
I have a url rewrite that looks like this: RewriteEngine On RewriteRule ^cancun/tours/$ location-tours-listings.php?locationName=Cancun
I'm trying to serve all static files (js, css, images) from a CDN instead
How can i rewrite dynamic image URLs to their original origin? Example url /images/products/2658-14732-sergeant-dolly-jacket-olive-full.jpg
I want to rewrite URLs using .htaccess I want mod_rewrite to match ANY URL
I'm wanting to rewrite Word Press urls using mod_rewrite in my .htaccess file in
I am using UrlRewriter to rewrite my urls in an ASP.NET application. Everything works

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.