0

I dont really know how to search for this issue I am having. I have to deploy a CMS to a subfolder of a domain for a school project: www.domain.de/new Problem is, that the CMS references all files using absolute paths, so the path for the css for example is "www.domain.de/styles/file.css" instead of "www.domain.de/new/styles/file.css"

For this Problem our advisor told us he had an htaccess-file for this exact problem. It contained

RewriteEngine On
RewriteBase /new/

It did not do anything (as far as we can tell) and I was not really suprised. Please tell me if I am wrong, but I thought htaccess-files will just be "executed" it you enter the folder they are in, so to have a rewrite that will affect the absolute paths we have to place the htaccess-file in the root folde? Which we can't.

The only solution I can think of is using a subdomain to access the folder (something like new.domain.de) pointing to our new-directory.

Greetings Neokil

Neokil
  • 1
  • 2
  • http://stackoverflow.com/questions/21347768/what-does-rewritebase-do-and-how-to-use-it – Vrac Sep 15 '16 at 09:23

1 Answers1

0

You are correct - that .htaccess file does absolutely nothing. It sets a variable, but does nothing with it.

Assuming you don't have access to the source code of this CMS, then, yes, the solution you propose (putting it in a root folder of a new domain) is the most effective solution.

Failing that, you could use something like mod_substitute - http://httpd.apache.org/docs/current/mod/mod_substitute.html - to modify the HTML as it is being served to the client, thus rendering the CSS URLs correct. Something like:

Substitute s!/styles/!/new/styles/!

I suspect, however, that that would only be a partial solution.

Naturally, being me, I'd recommend one of the 23 million open source CMSes out there, rather than this one that seems rather poorly designed. Or possibly your "advisor" just doesn't know what he is talking about.

Rich Bowen
  • 5,872
  • 2
  • 17
  • 15