Jump to content

Problem with .htaccess mod_rewrite


Recommended Posts

I'm looking at some tutorials for mod_rewrite and I am trying to replicate a simple example:

 

In my .htaccess file I put this:

 

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_ACCEPT} text/html
RewriteRule \.html$ - [T=text/html;charset=utf-8]
RewriteRule ^old\.html$ new.html [R]
</IfModule>

 

When I access http://mywebsite.heliohost.org/img/old.html

 

It redirects me to http://mywebsite.heliohost.org/home/myname/public_html/img/new.html

 

Why is this? How do I fix this? I've been looking all over the internet and there is absolutely nothing.

 

I even tried this on another server and the same thing happens, so I must be doing something wrong.

 

EDIT:

 

Okay, I feel dumb now. I removed [R] and it suddenly started working! I'm not sure why [R] was the culprit, but it works without it.

Link to comment
Share on other sites

  • 3 weeks later...

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.   Paste as plain text instead

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