I am using wordpress and have pages for each state as well and a small script which loads information for each city so the urls are like this http://site.com/states/louisiana/?city=Shreveport Stats = Page Lousiana = SubPage Can anyone help me how to turn this into http://site.com/states/louisiana/Shreveport My current .htaccess file is # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> Code (markup): Will pay $5 to first who can post solution
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] RewriteRule ^states\/(.*)\/(.*)$ /states/$1/?city=$2 [L] </IfModule>
insert following: RewriteRule ^?city=(\w+)$ $1 .................................. # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] RewriteRule ^?city=(\w+)$ $1 </IfModule>
does this help? rewriteEngine On rewriterule ^states/(.+)/(.+)$ yourscript.php?city=$2 [L] # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END wordpress Code (markup):