http.conf URL rewrite - remove all FQDN links

Hi All,

I work for a company that doesn't have internet access.  I'd like to use some open source software, but it because it has loads of internet based content embedded - e.g. google fonts.  It takes ages to load.

Would it be possible to change all links to local

e.g.

http://themes.googleusercontent.com/static/fonts/opensans/v6/DXI1ORHCpsQm3Vp6mXoaTXhCUOGz7vYGh680lGh-uXM.woff 

To

/static/fonts/opensans/v6/DXI1ORHCpsQm3Vp6mXoaTXhCUOGz7vYGh680lGh-uXM.woff


Many thanks
D
LVL 2
detox1978Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dr. KlahnPrincipal Software EngineerCommented:
Technically, sure, this can be done.

In real life, it's often impractical.

  • You would have to go through every single page, find out where the internet downloaded "stuff" is, download it as an imaged file, and then store those imaged files locally.
  • Some content is dynamically generated, which means the next time you use it it'll be out of date or it won't work.
  • Some content depends on other content you can't see back at the issuers' sites, such as big databases
  • A lot of content wants to use cookies (either standard or Flash) and that problem is messy to deal with.
0
detox1978Author Commented:
There arent that many pages, so only 20ish urls that need switching.

Need help getting it to work.
0
detox1978Author Commented:
The question is how to change URL's using http.rewrite, so I don't need to go through each page.

I just need to know the URL's that I'd like to change and http.rewrite will update them before sending the web browser.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

RobOwner (Aidellio)Commented:
Replace "YOURDOMAIN.COM" with your actual domain

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^YOURDOMAIN\.com$ [NC]
RewriteRule ^(.*)$ %{SERVER_PROTOCOL}://YOURDOMAIN.com/%{REQUEST_URI} [R=301,L]

Open in new window

0
detox1978Author Commented:
Sorry for the delay in responding.  I've been away with work.

The website URL is http://helpdesk.  I added the code below which is being picked up but doesn't change all the URLs to http://helpdesk

RewriteBase /
RewriteCond %{HTTP_HOST} !^helpdesk$ [NC]
RewriteRule ^(.*)$ %{SERVER_PROTOCOL}://helpdesk/%{REQUEST_URI} [R=301,L]

Open in new window


Any suggestion?
0
detox1978Author Commented:
e.g. if the source code links to a javascript file https://www.google-analytics.com/ga.js.  The user would look receive http://helpdesk/ga.js
0
RobOwner (Aidellio)Commented:
ah okay... I was also matching the protocol (http/https)

I've modified it for you below:

RewriteBase /
RewriteCond %{HTTP_HOST} !^helpdesk$ [NC]
RewriteRule ^(.*)$ http://helpdesk/%{REQUEST_URI} [R=301,L]
0
RobOwner (Aidellio)Commented:
I'll object to keep this going as i've realised a huge mistake in this approach... the reason it's not redirecting is because the browser doesn't request the javascript files from your server so it CANNOT be rewritten... apologies that i didn't realise this earlier.

You either need to search and replace (as was suggested above) all the domains with your "http://helpdesk/" which wouldn't be that hard using regex
OR
Install a proxy server that can do the rewrite for you (a lot of mucking around if you ask me but it's possible)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.