You get a bonus - 1 coin for daily activity. Now you have 1 coin

How to change the root folder for Symfony using .htaccess

Practice




how do I change the root folder for Symfony using the .htaccess file


in the root .htaccess it's like this

RewriteEngine On
RewriteRule ^(.*)$ /web/$1 [R]


and in /web/.htaccess


RewriteEngine On

#
# RewriteBase /
#


RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app_dev.php [QSA,L]


and the site works with paths like
http://site.aa/web/register/
http://site.aa/web/home/
but I want it without web
http://site.aa/register/
http://site.aa/home/

note that the path rewriting is done by the file app_dev.php

most likely impossible
using only .htaccess

unless you get creative

but the easiest way will be
to change httpd.conf

the line
DocumentRoot "/home/my-city.com.ua/public_html/"
to DocumentRoot "/home/my-city.com.ua/public_html/web"


you should have something roughly like this in your config:


DocumentRoot "/home/my-city.com.ua/public_html/web"
ServerName "my-city.com.ua"

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Running server side scripts using PHP as an example (LAMP)"

Terms: Running server side scripts using PHP as an example (LAMP)