Rakesh Shetty
Rakesh Shetty

Reputation: 4578

Not running .htaccess file using php

Im new to this I want to write .htaccess file for my project.I wrote this code as im running on my localhost :-

RewriteEngine on
RewriteRule ^http://192.168.1.185/location/new/project/rss\.php$   http://192.168.1.185/location/new/project/folder/rss.php

I want to redirect http://192.168.1.185/location/new/project/rss.php to http://192.168.1.185/location/new/project/folder/rss.php

This not working.Is im doing anything wrong? please help me on this thanks in advance

Upvotes: 0

Views: 119

Answers (3)

Nadav S.
Nadav S.

Reputation: 2459

If you want to put the .htaccess file inside the root of your website, you should write:

Redirect /vroomrelocation/new/vroomvroom/rss.php /vroomrelocation/new/vroomvroom/yash/rss.php

I recommend to put the file inside /vroomrelocation/new/vroomvroom/ and write:

Redirect rss.php yash/rss.php

Upvotes: 0

user188654
user188654

Reputation:

Rewrite rules only take the path part of the URL (URI) into consideration (an excellent article on mod_rewrite). The rest is ignored.

However, if your redirection needs to be permanent its much better to avoid mod_rewrite and simply use Redirect.

Redirect /vroomrelocation/new/vroomvroom/rss.php /vroomrelocation/new/vroomvroom/yash/rss.php

Upvotes: 1

Peon
Peon

Reputation: 8020

I'm no expert in htaccess myself, but this should work:

# Redirect old file path to new file path
Redirect rss.php http://192.168.1.185/vroomrelocation/new/vroomvroom/yash/rss.php

And put it in the rss.php directory, not the base directory.

Upvotes: 1

Related Questions