tags:

views:

26

answers:

1

Hi,

I'm a little stuck with with my .htaccess redirect. It was working find while I was with PHP4 but the recent move to a new host with PHP5 have changed things for which I've no clue.

I run a URL shortening service for NSFW links so they're a little safer at nsfw.in Here, for a URL like http://nsfw.in/e72b0f (this one is actually SFW) it gives me http://nsfw.in/forward.php?e72b0f

Earlier with my .htaccess file, the "forward.php?" was masked (hidden). How can I bring back this behavior. Here is the .htaccess for your reference.

Options +FollowSymlinks
RewriteEngine On
RewriteBase /

RewriteCond   %{REQUEST_URI} \/([0-9a-z]{6})$ [NC]
RewriteRule   ^(.*) http://nsfw.in/forward.php?%1 [L]

Thanking in anticipation. Btw, I also do not rule out the issue being in the PHP Script. The developer that did it for me is too busy to look at it.

+1  A: 

If you rewrite to an http:// URL that the server doesn't think is in the site, mod_rewrite will do a redirect instead of just a rewrite. In order to see if this is happening, make a page that has nothing in it but

<?php echo $_SERVER['SERVER_NAME']; ?>

and see if going to it says "nsfw.in".

Either way, you should be able to strip off the http://nsfw.in from the beginning of the URL and just rewrite it to /forward.php?%1 . You may need to add a PT flag in order for it to be interpreted as a URL and not a FS path.

cHao
Super! That's it, I just removed the actual URL and ask it to redirect from the root and it worked. Thanks a lot.
Brajeshwar