Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

314
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!