Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

329
Visualizações
How should I succesfully rewrite a url for use on remote server?

My site worked properly on localhost but on upload to the remote server, only the index.php page is working. The other urls such as login (see below) are not working and return a 404 Not Found error.

The Model-View-Controller design pattern has been implemented so that all pages on the site render through index.php using the appropriate view file.

Simply, the site is designed to work as follows:

  • index.php page is stored in: www.subdom.mysite.com/public

  • login to the site is via the link www.subdom.mysite.com/public/user/login where 'user' is a controller PHP class file and 'login' is a method of that class. 'user' and 'login' are used to rewrite the url. The 'login' method prepares the html required for the user login form and passes it to the 'index' view for rendering in the browser.

  • Additional site functionality works on the same principle as above e.g., making a bank payment via www.subdom.mysite.com/public/bank/payment

Below is my .htaccess file - also stored in the /public folder above. The only change I made to this file after upload to the remote server is on the RewriteBase line.

    Options -MultiViews
    RewriteEngine On

    ######################
    # Localhost version of the RewriteBase statement:
    # RewriteBase /subdom/public
    ######################

    # Remote server version of the RewriteBase statement (as displayed in host's cPanel):
    RewriteBase /home2/user/subdom.mysite.com/public

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.+)$ index.php?atid=$1 [QSA,L]

I've been pulling my hair out for the last few days over this issue. I don't know what I'm missing or what amendments I need to make and so would really appreciate your help to get this working.

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda