I know there's a lot of answers on here though none are very specific for this.
Currently I have a domain with a blog section set out like this:
example.com/news this is a single page then
example.com/news/entries
example.com/news/topics/(topic) also a single page
So what I'm after is to change my htaccess to change everything from 'news' to 'blog' as we have a lot of social media posts linking to the old news/entries etc.
Currently I was thinking of this:
RewriteRule ^/news(.*)$ $1/blog(.*)[L,R=301]
Just wondering if this is the right approach as I want everything, including the single page to change from news to blog.
Thank you in advance community.
Related
I have a website that write URLs like this:
mypage.com/post/3453/post-title-name-person
In fact, what is important is the post and ID part (3453). The title I just add for SEO.
I changed some title names recently, but people can still using the old URL to access, because I just get the ID to open the page, so:
mypage.com/post/3453/post-title-name-person
mypage.com/post/3453/name-person
...
Will open the same page.
Is it wrong? Google webmaster tools tells me that I have 8765 duplications pages. So, to try to solve this I am redirecting old title to post/id/current-title but it seems that Google doesn't understand this redirecting and still give me duplications.
Should i redirect to not found if title doesn't match with the actual data base? (But this can be a problem because links that people shared won't open) Or what?
Maybe Google has not processed your redirections yet. It may take several weeks and sometimes several months to process all pages, especially if they are not revisited often. Make sure your redirects are 301 and not 302 (temporary).
That being said, there is a better method than redirections for duplicate pages: the canonical tag. If you can, implement it. There is less risk to mix up redirections.
Google can pick your new URL's only after the implementation of 301 redirection through .htaccess file. You should always need to remember that 301 re-direct should be proper and one to one to the new url. After this implementation you need to fetch those new URL via Google Search console so that Google index those URL's fast.
Our site is using communities for specific subject areas of the site. For SEO reasons, we want to remove the /web component in the URL. We want to exclude this component for all of the communities in the site.
In essence, given a site.com, and a community ranging from named user[1-inf], then instead of this:
site.com/web/user1
We want to have this:
site.com/user1
For each user's public page.
I've been tampering around with layout.friendly.url.public.servlet.mapping, giving it an empty string and replacing the corresponding lines in the web.xml file, but this solution doesn't work at all.
Has anyone been able to do this?
Currently using liferay 6.2
Thank you in advance!
If it was for a single site, you should explore the "virtual host" setting in a site which removes the whole "/web/site-name" part and assigns this to a unique hostname (or "/group/site-name" for private pages).
As you're asking for all user accounts, this is a bit harder. Some solutions that come to mind:
If you have a limited amount of users and rarely add new ones, Apache-Level Rewrites might make sense.
A ServletFilter (which you can add as a plugin) could help resolving the required pages and rewrite internal to Liferay. This has the advantage of being totally responsive to the currently existing user accounts - as soon as you have a new user, you can resolve their pages. Make sure to disallow usernames though that would clash with Liferay paths - e.g. "c", "web", "group", "images", "html" etc.
If you want all the links internally generated to the user's homepage to point to your changed locations, you might need to override some of Liferay's services. You'll have to find the places where the URLs are generated (if not read from db) and override it. I'm expecting that a simple service override will suffice, but haven't looked at it
in your .htaccess
RewriteEngine On
RewriteRule ^$ /web [L]
I have a website ranking well in Google, my current website has dashes in and looks like so...
this-is-mine.com
Ive just also bought
thisismine.com
I'd like to point the latter to my first site, but I dont want it to be classed as duplicate content.
I'm unsure if I just do this through 123-reg but will this affect my Google rankings, or is there a correct way of doing this without penalising myself?
According to the link below, my thoughts are confirmed.
A 301 is fine as it forwards everything including page rank to the "new" site. In your case this-is-mine.com.
A 302 could/would be a problem for SEO.
http://seo-hacker.com/301-302-redirect-affect-seo/
If your current website is ranking well then don't disturb it. There is no benefits in pointing multiple domains on one website. You can also make a single page website on the new domain and optimize it for Google and link with your old one.
If you still want to do this then do a 301 redirect but make sure that the domain is new and has no spammy back links pointing to it.
I am developing a site on Codeigniter 2.0.2 . Its a site where companies/users can signup and create their own profile page, have their own custom url(like http://facebook.com/demouser), have their own feedback system, display their services.
This said, I have been successful in display the profile page in the following format
http://mainwebsite.com/company/profile/samplecompany
This displays the home page for the company samplecompany , where company is the controller and profile is the method.
Now I have few questions,
I guess it is possible to create to have/get http://mainwebsite.com/samplecompany using htaccess and a default controller. If anybody can help with the htaccess rule , that would be awesome. I am already using htacess to remove index.php from CI but could not get this working.
There will be few other pages for the given user/company such as feedback, contact us, services etc. So the implementation links that come to my mind is of the form
`
http://mainwebsite.com/company/profile/samplecompany/feedback or
http://mainwebsite.com/samplecompany/feedback
http://mainwebsite.com/company/profile/samplecompany/services or
http://mainwebsite.com/samplecompany/services
http://mainwebsite.com/company/profile/samplecompany/contactus or
http://mainwebsite.com/samplecompany/contactus
wheresamplecompany` is the dynamic part
Is it possible to create site links in the format?
I understand using A record for a given domain, I can point a domain say, http://www.samplecompany.com to http://mainwebsite.com/company/profile/samplecompany so typing http://www.samplecompany.com he should be taken to http://mainwebsite.com/company/profile/samplecompany . If this is successfully implemented, will
http://www.samplecompany.com/feedback
http://www.samplecompany.com/services
http://www.samplecompany.com/contactus
work correctly?
I guess it is possible to create to have/get http://mainwebsite.com/samplecompany using htaccess and a default controller. If anybody can help with the htaccess rule , that would be awesome. I am already using htacess to remove index.php from CI but could not get this working.
There will be few other pages for the given user/company such as feedback, contact us, services etc. So the implementation links that come to my mind is of the form ` http://mainwebsite.com/company/profile/samplecompany/feedback or http://mainwebsite.com/samplecompany/feedback
You can accomplish this using routes. For example, in your /config/routes.php file, put this:
$route['samplecompany'] = "company/profile/samplecompany";
$route['samplecompany/(:any)'] = "company/profiles/samplecompany/$1";
The first rule tells CodeIgniter that when someone accesses http://mainwebsite.com/samplecompany that it should process it as if the URL were "company/profile/samplecompany". The second rule captures anything that comes in the URI string after "samplecompany" and appends it onto the end.
However, if you have multiple companies(not just samplecompany), you're probably going to want to extend CI's router to suppor this unless you want to manually edit the config file each time a new company is added.
OK, you're definitely going to want to handle dynamic company names(as per your comment). This is a little trickier. I can't give you the full code, but I can point you in the right direction.
You'll want to extend CI's router and on an incoming request query the DB for the list of company names. If the URI segment matches a company name, you'll want to serve it up using your company/profile method. If it does not, you will ignore it and let CI handle it normally. Check out this post on this topic for more information: forum link.
Here's a great guide on how to achieve what you need: Codeigniter Vanity URL's.
I have a CodeIgniter 2.0 application in a subfolder of our existing corporate site. I plan to add functionality to the site through this application which is in a folder named "ci."
The documentation of CodeIgniter explains .htaccess use in a "negative way" in that EVERYTHING is redirected EXCEPT exceptions. I am paranoid about doing this and "breaking" my existing site.
How would you write the .htaccess to ONLY redirect /news requests to a controller named News and /careers requests to a controller named Careers without preventing the original site from working as it does now?
I have NEVER used .htaccess before and have just "endured" the index.php out of fear of breaking the site. I did do some research before asking -- besides the CodeIgniter User Guide, I also found "The Comprehensive Guide to .htaccess" (http://www.javascriptkit.com/howto/htaccess.shtml) and URL Rewriting (http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html) which were in depth but did not clarify for me what to do.
Thanks in Advance,
Jon
The expressionengine documentation on writing out index.php shows examples of both the 'positve' and 'negative' ways you refer to.
http://expressionengine.com/wiki/Remove_index.php_From_URLs/