1

I'm working on my first symfony 4 project and i would like to upload it on my online server. My goal is to have it online on my domain to test it before a preview with my client.

I tried to put my files on the www folder (by ftp) and add a .htaccess in the main repository with :

<IfModule mod_rewrite.c>RewriteEngine On

# remove "www" from URI
RewriteCond %{HTTP_HOST} ^devfuzz\.(.+) [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]

# force HTTPS
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# use public as starting point
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]</IfModule>

And i added a .htaccess in public with :

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]

I tried so many thing found on many forum but i have always the same with when i try to go on my website :

website view

How can i change this view to have a normal navigation like i had with : php bin/console server:run in local

Noxray
  • 50
  • 5
  • 1
    which webserver (apache, nginx) in which version and which php (pfm, cgi etc.) in which version are installed on your "online server"? – LBA Mar 13 '19 at 11:29
  • My ovh server is on php 7.2 but i don't know my webserver version (and i don't really know if i have one installed) – Noxray Mar 13 '19 at 12:41
  • so, then this might be your issue – LBA Mar 13 '19 at 13:22
  • That was my apache configuration. Sorry for the lost of time, i'm stuck in hell until the end of this project =P – Noxray Mar 13 '19 at 15:43
  • You don't need to create the .htaccess yourself, use apache-pack. My answer here may help: https://stackoverflow.com/questions/47949952/symfony4-deploy-to-shared-hosting/48970883#48970883 – Arleigh Hix Mar 13 '19 at 17:54
  • tried but didn't work =/ – Noxray Mar 14 '19 at 12:49

1 Answers1

2

Try to change your code with this one :

  # remove "www" from URI
  RewriteCond %{HTTP_HOST} ^www\.(.+) [NC]
  RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]

You don't need to remove the www in this part of code, this code will do it for you so do NOT change it :)

Lindaia
  • 228
  • 2
  • 8