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
-
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.
-
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 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.
-
Thanks for that pointer goonewscowboy, I just stumbled across this article and it was a good read
-
This line should exclude that part: index.php?page=
Just try if it works.
-
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.
-
Hiya Craig: This post from YOUmoz might help you to be able to wrap your mind around it better.
-
Will this have any negative effect in the serps?
-
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]
-
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]
-
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
-
What about:
RewriteRule ^index.php?page=(.*)$ /$1 [R=301,L]
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
How do I customize Magento product urls?
I would like my product urls to be /category/manufacturer/name/part#. This would be the only url the item uses and how the product is accessed. It would also be used for product feeds. My first attempt was to use https://amasty.com/magento-unique-product-url.html This creates a single url but I can not customize it. Sometimes it selects the manufacturer and sometimes the category. My second attempt was with https://www.magentocommerce.com/magento-connect/custom-product-urls-seo.html I have it installed but it doesn't change the urls. Has anyone been able to do this successfully?
Technical SEO | | Tylerj0 -
HTTP URLs Still in Index
One of the sites I manage was migrated to secure 2 months ago. XML sitemaps have been updated, canonical tags all have https:, and a redirect rule was applied. Despite all this, I'm still seeing non-secure URLs in Google's index. The weird thing is, when I click those links, they go to the secure version. Has anyone else seen weird things with Google not properly indexing secure versions of URLs?
Technical SEO | | LoganRay0 -
Why put rel=canonical to the same url ?
Hi all. I've heard that it's good to put the link rel canonical in your header even when there is no other important or prefered version of that url. If you take a look at moz.com and see the code, you'll see that they put the <link rel="<a class="attribute-value">canonical</a>" href="http://moz.com" /> ... pointing at the same url ! But if you go to http://moz.com/products/pricing for example, they have no canonical there ! WHY ? Thanks in advance !
Technical SEO | | Tintanus0 -
%20 URL accessible, does this matter?
I have a rewrite on the CMS I work on. What happens here is that if someone creates a page on the website and uses spaces as the name then the CMS automatically replaces the spaces with -'s. I noticed this morning that the %20 URLs are accessible but not indexed at all. Only the - URLs are indexed. could this cause duplicate content or penalties? I know best practice is to have only ONE URL for a page but somehow the developer can't redirect the %20 URLs to the - URLs. Opinions?
Technical SEO | | DROIDSTERS0 -
Are you allowed to point different urls to same page
hi, i have some urls that i am either going to put on hold or thinking about pointing to one of my sites. what it is, i am looking at re-designing the pages but not until next year, so i thought i would point some of the urls to a site that i am happy with to different pages, but not sure if i am allowed this or not so for example, if i have a site on cars, and one of the url is www.rovercars.co.uk i was thinking about pointing it to the page that is about rover cars. can anyone let me know if this is allowed or not please
Technical SEO | | ClaireH-1848860 -
Webmaster tools...URL Errors
Hi mozzers, Quick question. Whats the best thing to do about URL errors in webmaster tools. They are all 404s that point from external sites. Many of them are junk spam sites. Should I mark them as "fixed" or just leave them. I'm hoping google is aware it's out of my control if spam sites want to link to 404s on my site. Peter
Technical SEO | | PeterM220 -
How to keep a URL social equity during a URL structure/name change?
We are in the process of making significant URL name/structure change to one of our property and we want to keep the social equity (likes, share, +1, tweets) from the old to the new URL. We have been trying many different option without success. We are running our social "button" in an iframe. Thanks
Technical SEO | | OlivierChateau0 -
When URL rewrite can lead to un pretty URLs
Hi Mozzers. I've a client that has done a little bit of mess rewriting the URLs of its site. In fact, also the data base driven URLs are rewritten, but the dev forgot to change the space with "-", so that now the 95% of the URLs are like this one: http://www.portalesardegna.com/search/Appartamenti e Residence/ Obviously not really a pretty URL. I am not so sure if this issue has an SEO consecuences (in fact, the site ranks pretty well also with those kind of url), but I am thinking more on usability issue. Could you suggest me any easy fix to this rewrite problem?
Technical SEO | | gfiorelli12