.htaccess rewrite rule problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
gurjit
Forum Contributor
Posts: 314
Joined: Thu May 15, 2003 11:53 am
Location: UK

.htaccess rewrite rule problem

Post by gurjit »

Hi

I have a rewrite rule as such

Options +FollowSymLinks
RewriteEngine on
RewriteBase /

RewriteRule ^about/our-team.html$ http://www.mydomain.co.uk/our-team.php [L]


I have created a link in my menu bar

http://www.mydomain.co.uk/about/our-team.html

Whats happening is that the correct page gets called which is http://www.mydomain.co.uk/our-team.php

but

the browser window shows link http://www.mydomain.co.uk/our-team.php

and not

http://www.mydomain.co.uk/about/our-team.html

so the friendly url is not getting displayed in the browser address bar.

why would this happen. It was all working fine and then my hosting company put me on a new server. They tell me its my htaccess but it worked on the old server for the last 8 months.

anyone had this problem?
JakeJ
Forum Regular
Posts: 675
Joined: Thu Dec 10, 2009 6:27 pm

Re: .htaccess rewrite rule problem

Post by JakeJ »

Could you possibly have another .htaccess in your directory structure that is overriding the one you think should be proving the friendly URL?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: .htaccess rewrite rule problem

Post by requinix »

Code: Select all

RewriteRule ^about/our-team.html$ http://www.mydomain.co.uk/our-team.php  [L]
Including the http://... tells Apache that it should not do the redirect internally and should redirect the browser instead.
Post Reply