Good day. At the moment I am busy remodeling the website. Can't solve several problems.
1.I need to change the url structure - for example a link to «somepage» like:
site.com/index.php?page=somepage
now will look like:
site.com/someCategory/somepage
As I understand in order not to lose page rank of «somepage» I need to do a 301 redirect. As I understand it will look like this:
Redirect 301 site.com/index.php?page=somepage site.com/someCategory/somepage
If more than one page (approximately 400) then it will look like this:
Redirect 301 site.com/index.php?page=somepage site.com/someCategory/somepage
Redirect 301 site.com/index.php?page=somepage1 site.com/someCategory/somepage1
Redirect 301 site.com/index.php?page=somepage2 site.com/someCategory/somepage2
Redirect 301 site.com/index.php?page=somepageN site.com/someCategory/somepageN
2.I need to make a redirect from www to non-www. It will look like this:
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
3.Also, currently my .htaccess file has rules to create pretty URLs:
DirectoryIndex index.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)/(.+)/?$ index.php?category=$1&page=$2
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)/?$ index.php?category=$1
The questions are:
- How to combine them all? In what order should I arrange it all?
- Whether redirection to work normally in the presence of about 400 301redirects?
- Maybe you can point me to my mistakes?