.htaccess redirection

Hello,
I’m sure it’s quite a stupid question, but I can’t manage to get my redirection with .htaccess work

I try to do this: http://my-site.com/pageX => http://my-site.com/index.php?url=pageX

The closer I got is with :

Options +FollowSymlinks RewriteEngine On RewriteRule (.*) index.php?url=%{HTTP_REFERER}
But it makes %{HTTP_REFERER}=http://my-site.com/pageX though I try to get “pageX” only…

Thanks for helping me without throwing me tomatoes to the face :slight_smile:

In similar situations I use this:

RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]+)/?$ /index.php?url=$1

There are two extra conditions are to avoid redirects for existing files/directories such as /images/ or /js/

Sponsor our Newsletter | Privacy Policy | Terms of Service