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

533
Views
Url rewrite rules error: The requested URL was not found on this server

I am create the rules in the .htaccess file in my domain folder.

My url on server is :

https://www.everyoneknows.com.my/customer/?loc=dashboard

And I want change url to:

https://www.everyoneknows.com.my/customer/dashboard/

In the .htaccess file, I write the rules are:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^everyoneknows\.com\.my [OR,NC] 
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.everyoneknows.com.my/$1 [R,L]

##External redirect to /customer/dashboard url rules here.
RewriteCond %{QUERY_STRING} ^loc\=dashboard$
RewriteRule ^customer/$ https://www.everyoneknows.com.my/customer/dashboard/? [R=301,L]

And the error message is shown:

Not Found
The requested URL was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

picture

Hope someone can guide me on how to correct in my rewrite url rules. Thanks.

Original result:

enter image description here

Updated 1

enter image description here

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You need a redirect rule for old URL to new and an internal rewrite rule to handle pretty URL:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^everyoneknows\.com\.my [OR,NC] 
RewriteCond %{SERVER_PORT} 80
RewriteRule ^ https://www.everyoneknows.com.my%{REQUEST_URI} [R=301,NE,L]

# external redirect from actual URL to pretty one
RewriteCond %{THE_REQUEST} \s/+(customer)/\?loc=([^\s&]+) [NC]
RewriteRule ^ /%1/%2/? [R=301,L,NE]

# internal forward from pretty URL to actual one
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(customer)/([\w-]+)/?$ $1/?loc=$2 [L,QSA,NC]

This assumes there is no .htaccess in customer/ subdirectory. Make sure to clear your browser cache before testing this change.

over 4 years ago · Santiago Trujillo Report
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!