/    Sign up×
Community /Pin to ProfileBookmark

.htaccess help please

I’m trying to make it so the following link:

[url]http://www.somesite.com?city=somecity[/url]

will be instead re-written to:

[url]http://www.somesite.com/somecity[/url]

The existing .htaccess file I have is below. This strips out the .php extension and resolves the http/www URL issue. This works fine.

[B][U]Existing[/U][/B]

Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteCond %{HTTP_HOST} ^somesite.com
RewriteRule (.*) http://www.somesite.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /index.php HTTP/
RewriteRule ^index.php$ [url]http://www.somesite.com/[/url] [R=301,L]

RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}s([^.]+).php [NC]
RewriteRule ^ %1 [R,L,NC]

RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [L]

And this is what I’m adding at the end but it does absolutely nothing:

[U][B]Addition[/B][/U]

RewriteRule ^/city/([0-9]+) /www.somesite.com/city=$1

Does anyone have any thoughts as to why this isn’t working?

to post a comment
Full-stack Developer

0Be the first to comment 😎

×

Success!

Help @Ntrimgs spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.3,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...