php - A way to not show 2 of 3 parameters in a url using .htaccess

878

I have the following in my .htaccess file:

RewriteCond %{THE_REQUEST} \s/+Category\.php\?pageNum_RS_Search=([^\s&]+)&totalRows_RS_Search=([^\s&]+)&Category=([^\s&]+) [NC]
RewriteRule ^ /Compare/%3/%2/%1? [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^Compare/([^/]+)/([^/]+)/([^/]+)/?$ /Category.php?pageNum_RS_Search=$3&totalRows_RS_Search=$2&Category=$1 [L,QSA]

I have tried the following:

RewriteRule ^Compare/([^/]+)/?$ /Category.php?pageNum_RS_Search=$3&totalRows_RS_Search=$2&Category=$1 [L,QSA]

This gave me the dreaded 404 error page not found, also tried to remove the%2/%1 that would not work at all as it still needs the values.

What i'm after is my page o look as follows:

mysite.co.uk/Category name/

(not show the last 2 paramaters but still use them to trigger the right page). Is this possible using .htaccess?

People are also looking for solutions to the problem: java - Create UML Class Diagrams from Code Using EMF in eclipse

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.