0

I had my document DocumentRoot set to www/fg. Before, I did browse to www/fg by typing http://www.mydomain.com/www/fg.

Then, I set up VirtualHosts that point to www/fg. And now I just type http://www.mydomain.com.

The problem is that my web developer wrote links as www/fg/image.png. And thos links are not accessable anymore. There is a way to tell apache to rewrite any link like http://www.mydomain.com/www/fg/image.png to http://www.mydomain.com/image.png?

I would also change links like http://www.mydomain/www/fg/somelink to http://www.mydomain.com/somelink.

Same for https. Regards

gdm
  • 459
  • 2
  • 5
  • 19

2 Answers2

2

You can add alias in apache virtualhost which can make your images accessible with same link.

Alias /www/fg/ /var/www/fg/

Replace "/var/www/" with your DocumentRoot path.

Vaibhav Panmand
  • 1,038
  • 7
  • 17
  • thank you. I forgot to mention that I would also change links like http://www.mydomain/www/fg/somelink to http://www.mydomain.com/somelink. – gdm Jul 04 '14 at 10:16
0

The best solution is to replace all the links in the content with the correct versions.

However, during transition period, you can use the following:

RewriteRule ^/www/fg(.+)$ http://www.mydomain.com$1 [R=301,L]

So, if a user accesses http://www.mydomain.com/www/fg/anylink, he will be 301 redirected to http://www.mydomain.com/anylink.

Tero Kilkanen
  • 36,796
  • 3
  • 41
  • 63