I created 2 pages when starting my blog: the first page which only serves as a 'summary' of what my blog is about and the second page which is the one with actual content.
I don't want to keep the first page anymore because it seems pointless, so I want to 301 redirect it to the second page. But the first page is set as the front page and has the url of example.com. The second page is on example.com/second-page/.
I know that the redirect in the htaccess file should be done like this:
Redirect 301 /old-page.html /new-page.html
But my front page has no URL slug, so how do I write it?
Would Redirect 301 / /second-page/ work or would that redirect every page on my domain?
Note that I only want to redirect the front page and nothing else.
Could you please try following, this will redirect home page(based on your shown samples) eg--> http://localhost:80 TO http://localhost:80/second-page/. Please clear your browser cache before you test your URLs.
RewriteEngine ON
RewriteRule ^/?$ second-page [R=301,L]
Related
I migrated my e-commerce site oscommerce to open-cart and my old links coming to the open-cart site. whenever old links requested open-cart redirects to the homepage if the pattern is like this .../index.php?manufacturers_id=...
I changed .htacess file to exclude redirect to the homepage by defining these lines
RewriteCond %{REQUEST_URI} manufacturers_id
RewriteRule .* NOT.php
if requested url contains manufacturers_id "it will" redirect to NOT.php instead homepage. But these .htaccess definitions don't work
I also want to cancel 404 pages I prefer to use the server default error page.
How can I make this? Thank you
We want to redirect most , but not all, of a website wit a 301 redirect.
Will this work or is the first line to much ?
redirect 301 / http://designers-floor.nl/
redirect 301 /index.php http://designers-floor.nl/
redirect 301 /index.php/woonbeton http://designers-floor.nl/inspiratie/
The Redirect directive will redirect any url starting with the first fragment to the second fragment. The first directive will thus redirect the entire site. (docs)
I recommend testing with temporary redirects until you have accomplished what you want, because testing with permanent redirects will cause those redirects to be cached. Once everything works as expected you can make the redirects permanent. Make sure that the most specific url is always listed first, so that it is matched first.
If you cannot accomplish your goal with just the Redirect directives, you can either use RedirectMatch (docs) or the RewriteEngine of mod_rewrite (docs).
I expect this to be a simple answer, yet it is a question I have been struggling to confirm after searching on Google and through similar questions.
I am wanting to make sure that my site has a 301 redirect in place to redirect my website URL (example.com) to (www.example.com). When I type in the browser my URL without (www.) in front of it, my page opens as (www.example.com) which is good, however how can I be certain that Google sees this as a redirect for SEO purposes?
I have not added any redirects to my site, so unless my version of Magento (1.7.2) has this redirect already set up or the theme I am using has this redirect set up, then it won't be set up.
I have read that I will have to redirect every page, not just the Home page. I am also aware of the URL Rewrite Management tool in the Magento backend, but I don't know whether I need to add rewrite there or whether I need to enter them into the sitemap.xml or .htaccess file so that Google knows I want my links redirected to the (www.example.com) URL.
Thanks
It will be better direct using htaccess
# Redirect non-www to www:
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
http://dense13.com/blog/2008/02/27/redirecting-non-www-to-www-with-htaccess/
Also,changed in url of secure and unsecure url of magento instance
to
www.example.com ,for please go to admin>system>configuration>General>Web>
I'm using ExpressionEngine and it is generating a URL like this when viewing a specific category:
domain.com/index.php/template_group/template/category_URL_indicator/foo_category/
I would like to redirect visitors if they delete the specific category from the final segment of the URL. For example, if they made the URL this:
domain.com/index.php/template_group/template/category_URL_indicator/
I tried an .htaccess 301 redirect but redirecting the shorter URL also redirected the longer URL. That is, if I put this in .htaccess:
redirect 301 http://www.domain.com/index.php/template_group/template/category_URL_indicator http://www.domain.com
This also redirected the longer URL to become http://www.domain.com/foo_category/ - not what was required... Any suggestions welcome - thanks!
David.
Try using redirect match instead, along with begin/end boundaries:
redirect 301 ^index.php/template_group/template/category_URL_indicator$ http://www.domain.com
I'm having a problem getting an old WordPress site page to redirect to the new basic PHP site page.
Example: The old WordPress page with no extension is at http://example.com/levelone/leveltwo/pagename
The new page is at http://example.com/directory/pagename.php.
Here are several things I've tried:
redirect 301 /levelone/leveltwo/pagename http://example.com/directory/pagename.php
This did not work at all
Then I tried redirecting the directories first, then the page, like so:
RedirectMatch 301 ^/levelone/leveltwo/ http://example.com/directory/
redirect 301 /pagename http://example.com/pagename.php
This almost worked, but gave me the right URL but without the PHP extension.
I can't just redirect an old directory to a new one because there are actually many. The example is just one. The trouble seems to be going from a non-extension page to a page with the .php extension.
Here's another thing I tried:
RedirectMatch 301 ^/levelone/leveltwo/(.*)$ /directory/$1.php
redirect 301 /pagename http://example.com/pagename.php
This gave me http://example.com/directory/pagename/.php.
Solved: I got it to work with the following:
Redirect 301 /levelone/leveltwo/pagename/ http://example.com/directory/pagename.php
The problem seemed to be with the missing forward-slash after the old page name.
Try:
RedirectMatch 301 ^/levelone/leveltwo/(.*)$ /directory/$1.php
What's probably happening is the mod_alias and mod_rewrite aren't playing nice with each other. They're both in the URI-file mapping pipeline so when one does its processing, the URI (eventhough a redirect response is what's going to ultimately happen) continues to get processed, then when the redirect happens, the URI has been mangled by mod_rewrite.
You should just stick with mod_rewrite so that you can prevent any wordpress rules from doing its thing. Add these rules above any wordpress rules you have in your htaccess file:
RewriteEngine On
RewriteRule ^/?levelone/leveltwo/(.*)$ /directory/$1.php [L,R=301]