Summary of the problem: .htaccess file contents Note: I'm using wordpress. Post your solution here or PM it.
Try this... Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^diary/([0-9]+)-([0-9]+)-([0-9]+) /diary/?e=$1-$2-$3 [NC] PHP:
Ok sorry for the confusion. Here's my .htaccess. This redirects properly but the URL in the address bar changes to the ugly URL.
remove those things from htaccess and simply go to admin->misscelaneous->permalinks write custom like %postdate%/%postname%
@crivion I know how to do that. You see what I'm trying to do is pass a variable string to a specific wordpress page. For example city/City1, city/City2 where city is the page and City1 & City2 are the variables. So domain.com/city/City1 redirects to domain.com/city?var=City1. The problem is domain.com/city?var=City1 shows up in the browser instead of domain.com/city/City1. Still haven't found the solution yet.
RewriteRule ^(.*)/city/([a-zA-Z_\s]+)$ http://www.domain.com/$1/?city=$2 [R=301,L] i think you just need play with "[R=301,L]", the prolem there...and make rewrite condition too...
try using this Rewrite rule: RewriteRule ^([^.]+)/([^.]+)$ /$1/city=$2 [R=301] Code (markup): Your current rewrite rule applies for: http://www.YourDomain.com/variable1/city/variable2 [you need to remove that "city"]
@krishmk and @pcshop899 thanks but both of your solutions don't work. I think the problem is in the rewrite flag? Problem is still open.
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^city/([a-zA-Z0-9_\s]+)$ city?var=$1 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* /index.php [L] </IfModule> PM me plz
The above solution should work because it includes the numbers and since City1 had a number the other rewrites didnt work
@stok and @atlantaazfinest Thanks. However, the actual URL does not contain numbers at least the variable. The rewrite rule actually redirects fine as I've said in my first post. The only problem is that in the browser address bar, it turns back to something like /something/?variable=newyork. It should read like /something/city/newyork