wordpress.htaccessmod-rewrite

Wordpress htaccess modrewrite


This is my htaccess for wordpress

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

I create a category named "hotels" I like to change my url via mod rewrite apache module. My current url like this

http://www.mydomains.com/hotels?state=newyork&country=us

But I want url like below:

http://www.mydomains.com/hotels/us/newyork

How can i achieve this?

I tried to get url like this: http://www.mydomains.com/hotels/newyork from http://www.mydomains.com/hotels?state=newyork

so i used this line after the rewrite rule but it was not worked.

RewriteRule ^hotels/([^/]*)$ /hotels/?state=$1 [L]

Can some one please help me?

Thanks in advance


Solution

  • Is there a particular reason you are trying to change permalinks via htaccess? This is more effeciantly done thru the wordpress dashboard under

    Settings> Permalinks

    You can choose a custom permalink structure or choose from the pre selected ones given thru wordpress.