0

I have made an application (php, css, js) with absolute path like

<img src="/images/example.jpg" alt=""/>

and others for including resources (js, css, etc.)

The application was initially destinated to be hosted on a server like http://domain.com Now I need to host the site in a subfolder http://domain.com/2013/

How can I update my application and make it accessible in the new subfolder without update all the paths.

Maybe with .htaccess ?

4

2 回答 2

2

Setting the base href should solve your problem. The following should be placed in the <head> element of all your pages:

<base href="http://domain.com/2013/" />
于 2012-11-12T21:29:22.333 回答
0

Or you can to try this code in you .htaccess:

RewriteEngine on 
RewriteRule ^(.*)$ /2013/$1 [QSA,L]
于 2012-11-12T21:36:13.310 回答