I have no idea how to indicate that this hangs from another directory and that the url redirects me the part of perl scripts to the route without /cgi-bin/index.pl
If you have no idea, less who wants to answer you. You have to define something so that Apache can define where to rewrite.
I can think of 2 ways:
1. Rewrite if you do not have an extension of css / html / js / etc
An option, I do not know if it's useful, but I suppose it's the most viable in this case, it's rewriting depending on the extension of the file. In this way, we generate exceptions for each extension that you want to search outside of /cgi-bin/index.pl
.
RewriteEngine On
RewriteBase /
#Si no termina con estas extensiones
RewriteCond %{REQUEST_URI} !\.(?:html?|css|png|jpe?g|gif)$ [NC]
#Reescribir
RewriteRule (.+) cgi-bin/index.pl/$1 [L]
To which you should complete the list of file extensions that you do not have to rewrite.
2. Put exceptions to specific folders
Or we can rewrite, as long as you do not try to access any of the folders that you want to use as an exception.
RewriteEngine On
RewriteBase /
#Si no empieza con alguna de estas carpetas:
RewriteCond %{REQUEST_URI} !^(?:img|images|scripts|proyecto|bla|etc)(?:/|$) [NC]
#Reescribir
RewriteRule (.*) cgi-bin/index.pl/$1 [L]
Other options could be:
- Rewrite
cgi-bin/index.pl/
if the URL that is accessed does not exist.
- The 2 option but vice versa, rewrite only if it is a list of folders within
cgi-bin/index.pl/
predefined.
- Rewrite only if the file exists in
cgi-bin/index.pl/
.
- Rewrite only if you try to access a resource that is terminated in
.pl
.
- Open another port other than 80, and not rewrite in that port, then you would access your images as
http://tusitio.ext:1234/tu-script.js
(with the problem that another domain considers it).
... in short, some rule has to be fulfilled to differentiate it, but you are the programmer, and defining that is your task.