Ye Ol Developer
Ye Ol Developer

Reputation: 23

mod_rewrite + htaccess

I have a (Joomla) site that is not currently pointing to a domain, but is sitting directly on my server IP (i.e.: http://176.158.165.1/~sitename)

Whenever I try to test my mod_rewrite, I get 404 errors. I have tested on another site on the same server, but it works 100%. Could this problem be due to the direct link to the IP address?

My .htaccess file is as follows:

RewriteEngine On
Options +FollowSymLinks
Redirect /google.html http://www.google.com

Thanks,

Dev

Upvotes: 2

Views: 191

Answers (2)

Pekka
Pekka

Reputation: 449783

When working in a subdirectory, you need to add the directory name regardless where the htaccess file is placed:

Redirect /~sitename/google.html http://www.google.com

you can also use RewriteBase but to be totally honest, I never really figured out how to get that working, and I've been too lazy to sort it out.

Upvotes: 0

superfro
superfro

Reputation: 3302

try:

Redirect 301 /google.html http://www.google.com

Try #2: (using mod_rewrite)

RewriteRule ^google\.html$ http://www.google.com [R=301,NC,L]

Upvotes: 1

Related Questions