Answer the question
In order to leave comments, you need to log in
Is it possible to redirect with htaccess without changing the path after the domain name?
On a shared hosting, I would like to set up a redirect of all requests to www.sitename.ru/public/index.php so that www.sitename.ru remains in the address bar.
Now the .htaccess file looks like this.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|public|css|js|ini|png|jpg|gif|robots\.txt)
RewriteRule .* /public/index.php [L]
Answer the question
In order to leave comments, you need to log in
<IfModule dir_module>
DirectoryIndex index.php index.html index.htm
</IfModule>
RewriteCond %{REQUEST_METHOD} =GET
RewriteCond %{REQUEST_URI} ^(.*)/index\.php$
RewriteRule ^(.*)$ %1/ [R=301,L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question