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
To rewrite all requests to /index.php ,you can use :
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/index.php$
RewriteRule ^(.+)$ /index.php?url=$1 [NC,L]
The RewriteCondition RewriteCond %{REQUEST_URI} !^/index.php$ is important as it excludes the rewrite destination we are rewriting to and prevents infinite looping error.