1

i have configurate Htacess to remove arguement from URL * here's my htaccess so far:

Options +FollowSymLinks -Indexes -MultiViews RewriteEngine On RewriteBase / # ----- remove .php to .html -------- RewriteCond %{THE_REQUEST} \s/+(.+?)\.php[\s?] [NC] RewriteRule ^ /%1.html [R=302,L,NE] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{DOCUMENT_ROOT}/$1\.php -f [NC] RewriteRule ^(.+?)\.html$ $1.php [L,NC] # ----- END OF remove .php to .html -------- 

Now i want to make this URL

/nettoyage-detail-bureaux.html?id=31&desc=some_text 

to

/31/some_text 

NB : the file name in server is nettoyage-detail-bureaux.php

1 Answer 1

0

Keep your rules like this:

Options +FollowSymLinks -Indexes -MultiViews RewriteEngine On RewriteBase / RewriteCond %{THE_REQUEST} \s/+nettoyage-detail-bureaux\.(?:html|php)\?id=([^\s&]+)&desc=([^\s&]+) [NC] RewriteRule ^ /%1/%2? [R=302,L] RewriteRule ^([0-9]+)/(.+)$ nettoyage-detail-bureaux.php?id=$1&desc=$2 [L,NC] # ----- remove .php to .html -------- RewriteCond %{THE_REQUEST} \s/+(.+?)\.php[\s?] [NC] RewriteRule ^ /%1.html [R=302,L,NE] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{DOCUMENT_ROOT}/$1\.php -f [NC] RewriteRule ^(.+?)\.html$ $1.php [L,NC] # ----- END OF remove .php to .html -------- 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.