Sunday, August 26, 2018

mod rewrite - How to change htaccess to access symfony web directory



I am running symfony2 in Windows7 and Xampp:



http://localhost/symfony/web/app_dev.php/hello/symfony




How do I change web/.htaccess file to access symfony using the link below?



http://localhost/app_dev.php/hello/symfony



the default .htaccess is:



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



I tried adding Rewrite RewriteBase /symfony/web/ or RewriteBase symfony/web/ then php app/console cache:clear --env=prod --no-debug and also tried restarting apache.



RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
RewriteBase /symfony/web/ OR RewriteBase symfony/web/



And can I do the same in Nginx with Reverse proxy? How to change to access without symfony/web?


Answer



tried add 127.0.0.1 www.mysymfony.com.localhost
into etc/hosts
add the following into httpd.conf



# Be sure to only have this line once in your configuration
NameVirtualHost 127.0.0.1:80

# This is the configuration for your project

Listen 127.0.0.1:80


ServerName www.mysymfony.com.localhost
DocumentRoot "D:\xampp\htdocs\symfony\web"
DirectoryIndex app.php

AllowOverride All
Allow from All





access this link
http://www.mysymfony.com.localhost/app_dev.php/demo/hello/symfony
it gives an error,doesnt have this link


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...