I'm trying to build a url shortener, and I want to be able to take any characters immediately after the domain and have them passed as a variable url. So for example
would become
Here's what I have for mod_rewrite right now, but I keep getting a 400 Bad Request:
RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*) index.php?url=$1 [L,QSA]
Try replacing ^(.*) with ^(.*)$
^(.*)
^(.*)$
RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]
Edit: Try replacing index.php with /index.php
index.php
/index.php
RewriteRule ^(.*)$ /index.php?url=$1 [L,QSA]
1.4m articles
1.4m replys
5 comments
57.0k users