Jump to content

rewrite only works with full URL, why?


sKunKbad

Recommended Posts

I have a mod rewrite that works only when the full URL is in the hyperlink. If I don't have the link this way, the mod rewrite adds an extra directory and I get a 404 error. For instance If I code my link like this:

<a href='http://www.whatever.com/tips/1.php5'>Tip 1</a>

everything works fine.

If I code my link like this:

<a href='tips/1.php5'>Tip 1</a>

then the first time I follow the link it works fine, but on that page mod rewrite adds a directory to the url like this:

http://www.whatever.com/tips/tips/1.php5 and i get the 404 error.

I tried adding rewriteBase / to my .htaccess file, but this doesn't work.

Here is my rewrite code:

Options FollowSymLinks
rewriteEngine on
rewriteRule ^tips/([0-9]+).php5 /test/tips.php5?tip=$1 [NC]

Any suggestions?

Link to comment
https://forums.phpfreaks.com/topic/61011-rewrite-only-works-with-full-url-why/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.