Question about pretty URLs

This URL works perfectly in that the URL does not change in the address bar:

[noparse]http://www.oil-testimonials.com/essential-oils/7484/

Recently I have been working on a facelift for my website, so I put all the needed files into a directory called newVersion. Now when I go to this URL:

http://www.oil-testimonials.com/newVersion/essential-oils/7484

Somehow the URL is no longer pretty and reverts back to the ugly format:

http://www.oil-testimonials.com/newVersion/essential-oils.php?tID=7484[/noparse]

Here are the relevant lines in my .htaccess file:

RewriteRule ^essential-oils/([0-9]+)$ http://www.oil-testimonials.com/newVersion/essential-oils.php?tID=$1 [L]
RewriteRule ^essential-oils/([0-9]+)/$ http://www.oil-testimonials.com/newVersion/essential-oils.php?tID=$1 [L]
RewriteRule ^essential-oils/([0-9]+)/([a-zA-Z0-9\+]+)$ http://www.oil-testimonials.com/newVersion/essential-oils.php?tID=$1&q=$2 [L]

Does anyone know whey I have to use the full path otherwise the RewriteRule does not work? Does it have anything to do with the fact that I’m running this .htaccess file from within a subdirectory instead of from the root?

Thanks!

I don’t remember exactly but make sure you have options MultiViews or options +FollowSymLinks on in .htaccess, try both (seperatley) and see which one works.

[font=verdana]I’m not sure of why it isn’t working (Apache isn’t my forté), but one thing to point out … I hope this is just a development phase, and not a long-term thing. Having “newversion/” as part of a public URL is just awful. It looks so amateurish, adds a completely unnecessary layer of complexity to the URL (and an additional point of failure for people typing it in), hurts your SEO and looks completely ridiculous when you next revamp the site.

In other words, the basic format of the URL oil-testimonials.com/essential-oils/7484/ should always point to the correct version of the page!

Off Topic:

PS - where you’re just demonstrating a URL, please don’t allow it to become hyperlinked – either leave off the [noparse]http://www. at the start, or wrap it in [noparse]…[/noparse][/noparse] tags.

Stevie, not to worry, newVersion is just a temporary thing where I do all my testing. Once all is complete I will replace the code at the root with the code that is in /newVersion

bb,

You forced the display of the redirection with the absolute (external) redirection, i.e., http://yadda-yadda. The R=301 (permanent redirection) flag will do the same thing, too, so don’t use that if you need to hide your URIs.

Regards,

DK

dklynn,

When I take your advice and get rid of the full URL, my page only partially loads. Do you have any idea why? Here is what I have in my .htacess file:

When someone is trying to view a testimonial with this format:

oil-testimonials.com/newVersion/essential-oils/2657/lemon-oil-as-a-deodorant

RewriteRule ^essential-oils/([0-9]+)/([a-zA-Z0-9\-]+)$ essential-oils.php?tID=$1 [L]

bb,

The only reason I can think of is a problem with the PHP script. The only other possible reason is a default output which might happen if tID is not the correct key.

Regards,

DK

Do you reference any absolute paths in your PHP that don’t match the rewrited URL?