Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Symfony]Symfony - konfiguracja przekierowania w routing.yml, Jak zrobić przekierowanie w Symfony
Hektor132
post
Post #1





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 11.11.2009

Ostrzeżenie: (0%)
-----


Witam
W katalogu apps/backend/config mam plik routing.yml a w nim:

  1. <head>
  2. <meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
  3. </head>
  4. <PRE># You can find more information about this file on the symfony website:
  5. # <a href="http://www.symfony-project.org/reference/1_4/en/10-Routing&lt;/PRE&gt;" target="_blank">http://www.symfony-project.org/reference/1...ing</PRE></a>
  6. <PRE># default rules
  7. homepage:
  8. url: /
  9. param: { module: admin, action: actions }</PRE>
  10. <PRE># generic rules
  11. # please, remove them by adding more specific rules
  12. default_index:
  13. url: /:module
  14. param: { action: index }</PRE>
  15. <PRE>default:
  16. url: /:module/:action/*</PRE>


Czy może mi ktoś podpowiedzieć jak zrobić następujące przekierowanie

http://localhost/admin
przekierowuje na:
http://localhost/backend.php/admin

Pod drugim adresem mam widoczną stronę właściwą i chciałbym aby wyświetlała się ona po wpisaniu adresu pierwszego.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Hektor132
post
Post #2





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 11.11.2009

Ostrzeżenie: (0%)
-----


Ok w takim razie zawartość .htaccess:
  1. Options +FollowSymLinks +ExecCGI
  2.  
  3. <IfModule mod_rewrite.c>
  4. RewriteEngine On
  5.  
  6. # uncomment the following line, if you are having trouble
  7. # getting no_script_name to work
  8. #RewriteBase /
  9.  
  10. # we skip all files with .something
  11. # comment the following 3 lines to allow periods in routes
  12. RewriteCond %{REQUEST_URI} \..+$
  13. RewriteCond %{REQUEST_URI} !\.html$
  14. RewriteRule .* - [L]
  15.  
  16. # we check if the .html version is here (caching)
  17. RewriteRule ^$ index.html [QSA]
  18. RewriteRule ^([^.]+)$ $1.html [QSA]
  19. RewriteCond %{REQUEST_FILENAME} !-f
  20.  
  21. # no, so we redirect to our front web controller
  22. RewriteRule ^(.*)$ index.php [QSA,L]
  23. </IfModule>
  24.  
  25. # big crash from our front web controller
  26. ErrorDocument 500 "<h2>Application error</h2>symfony application failed to start properly"

i co tutaj trzeba dodać / zmienić żeby przekierować
http://localhost/admin
na:
http://localhost/backend.php/admin

Dodam że chodzi o katalogi web i apps
Pomocy (IMG:style_emoticons/default/blink.gif)

dodałem do .htaccess
  1. <Files ~ "^\.(htaccess|htpasswd)$">
  2. deny from all
  3. </Files>
  4. Redirect permanent /admin /backend.php/admin
  5. order deny,allow

i poskutkowało

jednak jak można na zamaskować adres:
http://localhost/backend.php/admin
  1. adresem:

http://localhost/backend.php/admin
(IMG:style_emoticons/default/questionmark.gif)
takie przekierowanie "brzydko" wygląda.

po wpisaniu pierwszego w pasku adreu wyświetla się drugi.
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 4.10.2025 - 13:53