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

532
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
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