URL Shortener, htaccess problem

Post here is you are having problems with any of the tutorials.
Post Reply
User avatar
rabatos
Posts: 46
Joined: Thu Aug 09, 2012 11:06 am

URL Shortener, htaccess problem

Post by rabatos »

For the URL shortener tutorial I can't seem to get the code in the htaccess file to work.

I entered:
[syntax=text]RewriteEngine On

RewriteRule ^([a-z0-9]+)$ go.php?key=$1[/syntax]

and when I enter, http://website.com/2 I just get a 404 error, and am not redirected to the go.php page at all.
Last edited by jacek on Sat Nov 17, 2012 12:18 am, edited 1 time in total.
Reason: code tags...
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: URL Shortener, htaccess problem

Post by jacek »

Is the file correctly named ? It should be .htaccess with the . at the start.
Image
User avatar
rabatos
Posts: 46
Joined: Thu Aug 09, 2012 11:06 am

Re: URL Shortener, htaccess problem

Post by rabatos »

Actually I've solved the problem.

The .htaccess file is fine because I've used it before for ErrorDocuments

I found it was a / before go.php I needed like so:

RewriteRule ^([a-z0-9]+)$ /go.php?key=$1 [L]
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: URL Shortener, htaccess problem

Post by jacek »

Ah okay, I probably would not have suggested that so thanks for posting the answer back :D
Image
Post Reply