3

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?

3
  • This is close to no research effort. There has to be tutorials/documentation for this. Commented Jun 16, 2012 at 11:51
  • @Olof Edler I am new to htaccess, i checked tutorial somewhere, but dont know how htaccess works Commented Jun 16, 2012 at 16:28
  • @r4: "There has to be tutorials" is also close to no research effort; I've just spent an hour looking for such a tutorial, and couldn't find one; if you know better, you would have posted an actual link to such a tutorial. Wish I could -1 your comment, too. Commented Aug 6, 2021 at 11:39

1 Answer 1

1

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<br>
NameVirtualHost 127.0.0.1:80

# This is the configuration for your project
Listen 127.0.0.1:80

<VirtualHost 127.0.0.1:80>
  ServerName www.mysymfony.com.localhost
  DocumentRoot "D:\xampp\htdocs\symfony\web"
  DirectoryIndex app.php
  <Directory "D:\xampp\htdocs\symfony\web">
    AllowOverride All
    Allow from All
  </Directory>
</VirtualHost>

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

Sign up to request clarification or add additional context in comments.

3 Comments

@m2mdas actually it doesnt work, I did restart apache, and even the system, it says No data received Unable to load the webpage because the server sent no data. Here are some suggestions: Reload this webpage later. Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.
@m2mdas after change httpd.conf and etc/hosts the old link http://localhost/symfony/web/app_dev.php/demo/hello/symfony still works
Remove RewriteBase line from .htaccess and try. Also form your httpd.conf I think server name would be www.mysymfony.com.localhost.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.