?
Solved

http.conf URL rewrite - remove all FQDN links

Posted on 2017-01-17
11
Medium Priority
?
67 Views
Last Modified: 2017-04-15
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
0
Comment
Question by:detox1978
  • 4
  • 3
8 Comments
 
LVL 30

Expert Comment

by:Dr. Klahn
ID: 41967648
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
 
LVL 2

Author Comment

by:detox1978
ID: 41973445
There arent that many pages, so only 20ish urls that need switching.

Need help getting it to work.
0
 
LVL 2

Author Comment

by:detox1978
ID: 41984555
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 43

Expert Comment

by:Rob
ID: 42006335
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
 
LVL 2

Author Comment

by:detox1978
ID: 42031026
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
 
LVL 2

Author Comment

by:detox1978
ID: 42031107
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
 
LVL 43

Expert Comment

by:Rob
ID: 42031911
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
 
LVL 43

Accepted Solution

by:
Rob earned 2000 total points
ID: 42031919
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

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What You Need to Know when Searching for a Webhost Provider
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses
Course of the Month16 days, 5 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question