How to modify HTML/Themeforest Themes to work in any path statically using unix/linux's sed command -

How to modify HTML/Themeforest Themes to work in any path statically using unix/linux's sed command

For themes and custom CMS setups, the typical HTML theme is not ready to go at all but here are some common sed commands (search and replace that will get most of them working without breaking as you'd expect).

The problem is that often the theme directory will be separate from the content and this will break the relative paths that these themes use.

sed -i s/'href="'/'href="\/themes\/yourtheme\/'/g index.html
sed -i s/'src="'/'src="\/themes\/yourtheme\/'/g index.html
sed -i s/"url(.."/"url(\/themes\/yourtheme\/"/g *.css

In the order of the above

replace all instances of href=" with href="/themes/yourtheme/

replace all instances of src=" with src="/themes/yourtheme/

replace all instances of "url(.. with url(/themes/yourtheme/


  • Linux how to view video card make and exact model
  • Authentication refused: bad ownership or modes for directory /home/user SSH Public Key Authentication Failed Solution
  • How to Update Linux /usr/share/misc/pci.ids
  • pcimodules and lspci not working alternative solution
  • How to disable Google Fonts in Wordpress
  • Unable to load dynamic library /usr/lib64/php/modules/php_openssl
  • mysqld in Linux hacked
  • W: GPG error: http://archive.debian.org squeeze Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY AED4B06F473041FA NO_PUBKEY 64481591B98321F9
  • cannot mount kvm ntfs image
  • h264 DVR security camera footage cannot be played
  • dhcpd.conf how to secure so only known and allowed clients will be given dhcpd IP address leases
  • Thunderbird E-mail List Blank White but e-mails still clickable and viewable
  • css responsive images
  • responsive table without changing much code solution
  • yum how to install old obsolete packages
  • PHP Howto Store Value of Included File Output Into Variable
  • PHP Migration from 5.3 to 5.4+ and dealing with deprecated functions
  • ffmpeg vidstab to stabilize video
  • userdel user userdel: cannot lock /etc/passwd; try again later.
  • mdadm how to mount inactive array