Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.