2

I'm using symfony in my local computer for programming. its address is http://localhost/RTL/web/app_dev.php/secure_area.

How can I change this address to http://localhost/secure_area?

I mean removing RTL/web/app_dev.php.

I'm using xampp, apache and symfony 2.6.

other addresses could be something like these:

http://localhost/RTL/web/app_dev.php/login    =>     http://localhost/login
http://localhost/RTL/web/app_dev.php/logout   =>     http://localhost/logout
http://localhost/RTL/web/app_dev.php/admin    =>     http://localhost/admin
3
  • 2
    if you work on local environment why you want to remove app_dev.php? In any case RTL/web is simply to removing adding a directive like this: DocumentRoot "C:/xampp/htdocs/localhost/RTL/web"on your virtual host. PS: is a common (and best) pratice to take the application folders out of the web root. Commented Dec 13, 2014 at 16:51
  • Thanks. If I want to deploy my application I should use app.php instead of app_dev.php. How can I remove that too??? Commented Dec 13, 2014 at 17:45
  • 2
    with some rewrite rules like here. Remember that you can't remove but only hide app.php from the url. Let me know if this works I will write the answer later. Commented Dec 13, 2014 at 18:08

1 Answer 1

1

Accordingly to the comments.

The RTL/web is removed adding the directive DocumentRoot "C:/xampp/htdocs/localhost/RTL/web" on your virtual host file in apache.

Then you can hide app.php using these apache mod_rewrite rules:

RewriteEngine On  
RewriteCond %{ENV:REDIRECT_STATUS} ^$  
RewriteRule ^app\.php(/(.*)|$) %{CONTEXT_PREFIX}/$2 [R=301,L]
RewriteRule .? - [L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*)$ app.php [QSA,L]
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
RewriteRule ^(.*) - [E=BASE:%1]    
RewriteRule .? %{ENV:BASE}app.php [L]

then restart apache server to apply the modifications.

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

Comments

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.