Hello , I have page like that : http://www.mydomain.com/name1-rates.html i wan to permanent redirect it to : http://www.mydomain.com/name1rates.html Also needs to redirect all another page have words ( rates ) to index
You should do that using 301 redirection. Simply add this to your .htaccess for that particular page: RewriteEngine On Redirect 301 /name1-rates.html http://www.mydomain.com/name1rates.html Redirect 301 /your-oldpage2.html http://www.mydomain.com/ and so on...
Thanks eldiable ,,, it's fine ,,, but name1 i changed varaiable on some of pages as : name1 , name2 , name3 ...etc I try to make it as this Redirect 301 /$1-rates.html http://www.mydomain.com/$1rates.html But not work ,,, kindly can help me in this ?
This code should do the trick for you: RewriteEngine On RewriteBase / RewriteRule ^name([0-9]+)-rates.html$ /name$1rates.html [L,R=301] #rewrites all nameX files RewriteRule ^([^/]+)-rates.html$ /? [L,R=301] #rewrites all other '-rates' pages to home page Code (markup): Cheers!
Interesting. Perhaps you should check few things then: Is your web site on a linux or a windows server? If linux, is it the apache or some other type of a server? If linux and apache, does it have mod rewrite support at all? To test this all, put some simple mod rewrite rule in your .htaccess just for testing purposes. For example: RewriteEngine on RewriteRule ^google\.html$ http://www.google.com/ [R] Code (markup): After that try just hitting yourdomain.com/google.html and if it doesn't redirect to google then mod rewrite is not even working for your account.
Dear Proton thanks for reply ... Yes sir i have already scripts work with mod rewrite very good as vbseo ,,, games script .. wordpress But this is special script i programing it ... and this link : http://www.mydomain.com/name-rates.html Name : is variable changed every page i need only remove "-" between name and rates . this command Redirect 301 /name1-rates.html http://www.mydomain.com/name1rates.html PHP: but i must be write name variable in htaccess to every page as Redirect 301 /myname-rates.html http://www.mydomain.com/mynamerates.html Redirect 301 /myname1-rates.html http://www.mydomain.com/myname1rates.html Redirect 301 /myname2-rates.html http://www.mydomain.com/myname2rates.html PHP: ETC ... and i have thousands of pages
Oh... so "name" is actually a variable, and not a fixed word. So then try something like this: RewriteRule ^([^/]+)-rates.html$ /$1rates.html [L,R=301] Code (markup): And make sure you have "RewriteEngine On" prior to that line. Basically this example should just loose - in your .html file name. Additionally, if the above example is not working properly again, make sure your destination page actually works when you try to open it directly. So for example try opening yourdomain.com/mynamerates.html directly in browser and check if it loads at all.
I believe the rule is correct, but the problem is related to something else. Perhaps someone else will notice something I'm not and provide different instructions though.