URL Rewrite
-
Using the .htaccess file how do I rewrite a url from
www.exampleurl.com/index.php?page=example
to
removing index.php?page=
Any help is muchly appreciated
-
What about:
RewriteRule ^index.php?page=(.*)$ /$1 [R=301,L]
-
And do I have to set up a new url or does it actually rewrite the existing URL?
I really can't get my head round this
-
This is what the current file looks like if it helps
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
-
RewriteEngine on RewriteRule ^page/([^/.]+)/?$ index.php?page=$1 [L]
If you're using the numbered (e.g. page=102) IDs:
RewriteEngine On RewriteRule ^article/([0-9]+)/? article.php&article=$1 [R=301, L]
-
Will this have any negative effect in the serps?
-
Hiya Craig: This post from YOUmoz might help you to be able to wrap your mind around it better.
-
URL rewriting is a common and safe practice and as goodnewscowboy points out: http://www.seomoz.org/ugc/a-simple-guide-to-htaccess - just test it and see that nothing funky is going on with your site and note that the above examples are not customised to your particular site / page structure.
Search engines are good with picking up 301s for new pages. If your pages are already in index and have links the only downside is that you may lose a bit of anchor text focus (I remember Matt Cutts talking about this in one of his videos) but link juice should pass through just fine.
-
This line should exclude that part: index.php?page=
Just try if it works.
-
Thanks for that pointer goonewscowboy, I just stumbled across this article and it was a good read
-
I had a similar problem and found this site particuarly useful: http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
Works great for me now. Good Luck.
-
You have to setup a new URL. The rewrite only redirects traffic. If the page doesnt exist you are redirecting traffic to a page that doesn't exist. No Bueno!
-
I would mark this question as answered, it seems that a lot of great minds have come together and given a lot of really accurate responses. It just keeps others from re-answering.