I cant understand how to redirect to the parent directory in this case: I have a root directory with .htaccess file, where rewriteEngine is on. In this directory I have a fi
You can't rewrite to paths that are outside your document root for security reasons. In fact this should be avoided because it is not a good practice.
Anyway, to answer your question, a workaround might be creating a symlink in your document root that points to the target/parent directory, but you should protect it from direct accesses.
Let me do an example. Assume that our document root is /var/www/project1
and that you want to rewrite on /var/www/project2/target.php
Then, you have to create a symlink inside /var/www/project1
that points to /var/www/project2
named (for example) p2
.
This should be your /var/www/project1/.htaccess
file:
RewriteEngine On
RewriteCond %{REQUEST_URI} /hello/world
RewriteRule ^(.*)$ p2/target.php [QSA,L] # p2 is the symlink name!