Liam
Liam

Reputation: 9855

HTAccess URL Rewrite affect GET variables

We’re using wordpress, and we have the following in the .htaccess:

# 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

We have a URL like http://subdomain.example.com/select-a-card/?q=fuel, and we want to rewrite it so that it becomes something like http://subdomain.example.com/fuel-card/

What do I need to add to the htaccess to do this? Also, will this affect the queries from running that uses GET variables?

Upvotes: 0

Views: 469

Answers (1)

giorgio
giorgio

Reputation: 10202

nothing, just read the wordpress manual and edit your settings. checkout http://codex.wordpress.org/Using_Permalinks

--- EDIT

This can be done, but only if you have some sort of a standard markup of the url's you want to have rewritten. Ie. if you only want to rewrite the select-a-card url's, or only the url's with a syntax like http://site.com/uri/?q=something. But you if the syntax of the url's differ too much you will have to add a lot of rewrites.

In this specific case something like this should work:

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

    # add your specifics below:
    RewriteRule ^/select-a-card/\?q=(.*) $1-card/

    RewriteRule . /index.php [L]
</IfModule>

Upvotes: 1

Related Questions