GautamD31
GautamD31

Reputation: 28763

Urls with hiding query parameters not working

Here my htaccess file is :

RewriteEngine on

RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteCond %{HTTP_HOST} ^(^.*)\.gautam.com

And at the end of the file I have writen :

RewriteRule ^jobs/([^\.]+)$ jobs?type=$1 [NC,L]

to change my url from :

gautam.com/jobs?type=what ever

to this

gautam.com/jobs/what ever

Upvotes: 3

Views: 63

Answers (2)

drew010
drew010

Reputation: 69937

Your rule looks fine but it should be moved above your other rewrite rules.

The following is superseding it because it comes first and /jobs/whatever probably meets the !-f and !-d criteria.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^([^\.]+)$ $1.php [NC,L]

Upvotes: 1

emilkitua
emilkitua

Reputation: 95

try this:

RewriteRule ^jobs/([0-9]+) jobs.php?type=$1

and if you want to pass 2 parameters:

RewriteRule ^jobs/([0-9]+)/([0-9a-zA-Z]+) jobs.php?id=$1&&message=$2

Upvotes: 1

Related Questions