g1smd

msg:4494655 | 9:39 am on Sep 13, 2012 (gmt 0) |
The Condition is needed on each rule that you want it apply to.
|
kellyman

msg:4494686 | 11:00 am on Sep 13, 2012 (gmt 0) |
I Have added RewriteCond %{REQUEST_URI} !^/run\.php to rule # - 32 Really sorry with all my requests for information i am trying to learn and have taken a lot on board RewriteEngine on # 2 Redirect Individual renamed pages RewriteRule ^oldpage1$ http://www.example.com/test/newpage1? [R=301,L] RewriteRule ^oldpage2$ http://www.example.com/test/newpage2? [R=301,L] RewriteRule ^oldpage3$ http://www.example.com/test/newpage3? [R=301,L] RewriteRule ^oldpage4$ http://www.example.com/test/newpage4? [R=301,L] RewriteRule ^oldpage5$ http://www.example.com/test/newpage5? [R=301,L] RewriteRule ^oldpage6$ http://www.example.com/test/newpage6? [R=301,L] RewriteRule ^oldpage7$ http://www.example.com/test/newpage7? [R=301,L] RewriteRule ^oldpage8$ http://www.example.com/test/newpage8? [R=301,L] RewriteRule ^oldpage9$ http://www.example.com/test/newpage9? [R=301,L] RewriteRule ^oldpage10$ http://www.example.com/test/newpage10? [R=301,L] RewriteRule ^oldpage11$ http://www.example.com/test/newpage11? [R=301,L] # 31 - Redirect index requests on new server RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index(\.(php|html?))? RewriteRule ^(([^/]+/)*)index(\.(php|html?))?$ http://www.example.com/$1? [R=301,L] # 32 - Redirect .php requests to extensionless URL RewriteCond %{REQUEST_URI} !^/run\.php RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(([^/]+/)*[^/.]+)\.php RewriteRule ^(([^/]+/)*[^/.]+)\.php$ http://www.example.com/$1? [R=301,L] # 33 - Redirect non-canonical requests to www RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$ RewriteRule (.*) http://www.example.com/$1 [R=301,L] |
|
|
kellyman

msg:4494765 | 3:08 pm on Sep 13, 2012 (gmt 0) |
Answered my own question it does work however i have noticed that the removal of the forward stroke works on the home page as does the upper and lower cases anything after the first trailing slash does not, so www.example.com perfect anything in the next directory level does not www.example.com/mysite RewriteEngine on # 2 Redirect Individual renamed pages RewriteRule ^oldpage1$ http://www.example.com/test/newpage1? [R=301,L] RewriteRule ^oldpage2$ http://www.example.com/test/newpage2? [R=301,L] RewriteRule ^oldpage3$ http://www.example.com/test/newpage3? [R=301,L] RewriteRule ^oldpage4$ http://www.example.com/test/newpage4? [R=301,L] RewriteRule ^oldpage5$ http://www.example.com/test/newpage5? [R=301,L] RewriteRule ^oldpage6$ http://www.example.com/test/newpage6? [R=301,L] RewriteRule ^oldpage7$ http://www.example.com/test/newpage7? [R=301,L] RewriteRule ^oldpage8$ http://www.example.com/test/newpage8? [R=301,L] RewriteRule ^oldpage9$ http://www.example.com/test/newpage9? [R=301,L] RewriteRule ^oldpage10$ http://www.example.com/test/newpage10? [R=301,L] RewriteRule ^oldpage11$ http://www.example.com/test/newpage11? [R=301,L] # 31 - Redirect index requests on new server RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index(\.(php|html?))? RewriteRule ^(([^/]+/)*)index(\.(php|html?))?$ http://www.example.com/$1? [R=301,L] # 32 - Redirect .php requests to extensionless URL RewriteCond %{REQUEST_URI} !^/run\.php RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(([^/]+/)*[^/.]+)\.php RewriteRule ^(([^/]+/)*[^/.]+)\.php$ http://www.example.com/$1? [R=301,L] # 33 - Redirect non-canonical requests to www RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$ RewriteRule (.*) http://www.example.com/$1 [R=301,L] |
|
|
lucy24

msg:4494891 | 8:58 pm on Sep 13, 2012 (gmt 0) |
| as does the upper and lower cases anything after the first trailing slash does not |
| Right. The domain name is case-insensitive (you can amuse yourself by looking up random domains at DomainTools or similar and see their wild & wonderful best guesses at intended casing :)); the rest of the URL is case-sensitive. Technically it depends on the server, but you should always treat it as case sensitive. Regular Expressions as used in Apache are case sensitive unless you expressly tell them not to be.
|
kellyman

msg:4494897 | 9:35 pm on Sep 13, 2012 (gmt 0) |
Hi Lucy24 Kind of Lost me, I think i done well getting this far, i really wish i fully understood as i marvel sometimes at what some developers and coders can do, if it were my main job and worked on this all the time im positive i would have a much better grasp on the whole process.. the code now is too complex for me to work out and i don't want to guess as its been 14 weeks for me without traffic and im blaming the old PHP redirect and wanted this Htaccess to replace what the PHP did just so as i can rule out any human error. If you could point me in the right direction of what would i should search for im sure i can find an example and implement and post back for confirmation, but im scared of just adding something which if im honest is a little out of my remit and i dont fully understand
|
swa66

msg:4495215 | 3:06 pm on Sep 14, 2012 (gmt 0) |
stuff like: | RewriteRule ^oldpage1$ http://www.example.com/test/newpage1? [R=301,L] |
| can also -easier IMHO- be written as:
RedirectPermanent /oldpage1.html http://www.example.com/test/newpage1 or
RedirectPermanent /oldpage1.html http://www.example.com/test/newdir1/
RedirectPermanent /olddir1/ http://www.example.com/test/newdir1/ I guess I started using this long before apache had rewriterules :-) Considering the capabilities for complex things rewriterules can handle, I'd still prefer the old Redirect (302) or RedirectPermanent (301) just for efficiency till I'd seen performance figures indicating otherwise.
|
lucy24

msg:4495350 | 9:50 pm on Sep 14, 2012 (gmt 0) |
Heh, you've missed several years on mod_alias ("redirect" by that name) vs mod_rewrite discussion. Using mod_alias is obviously easier and in fact it's what Apache recommends. BUT they seem to work on the assumption that you're doing this in the config file of your own server. If you're in htaccess, you have no control over which module executes first-- that is, whether your Redirects come before or after your RewriteRules. It doesn't matter how you arrange the htaccess; each module executes as a package. Doing everything with mod_rewrite means you can be sure things will happen in the right order, because within any one module your commands will execute in the order you put them.
|
g1smd

msg:4495418 | 6:40 am on Sep 15, 2012 (gmt 0) |
301 redirects generated by Redirect, RedirectMatch, RewriteRule or a HEADER directive in PHP all look exactly the same to the browser that made the original request. It's the module execution order and rule execution order that are crucial here, so you would want to use directives from only one module. So, mod_Alias (Redirect, RedirectMatch) can only do redirects while mod_Rewrite (RewriteRule) can do redirects or rewrites. As soon as you have a single RewriteRule it's time to convert all of your Redirect and RedirectMatch code to instead use RewriteRule.
|
lucy24

msg:4495448 | 11:31 am on Sep 15, 2012 (gmt 0) |
g1 sets a new record for time elapsed between opening a tab and posting reply to most recent visible post. "Dang! Could swear I answered this already!" ;)
|
g1smd

msg:4495511 | 4:13 pm on Sep 15, 2012 (gmt 0) |
I answered 6 hours before but with a silly typo which I didn't spot for 6 hours, so I reposted and a kindly mod zapped the obviously redundant copy some time later. :)
|
kellyman

msg:4496424 | 9:52 pm on Sep 17, 2012 (gmt 0) |
Hi Guys Reading an old thread on here in regard to best practice and although 2007 has much changed. [webmasterworld.com ] For instance is it too late for me to say rather than a site wide redirect i could redirect my top 100 pages and then let the rest go 404 or is 14 weeks into a change too late I really wish i could start this again as after all the reading and such there do seem to be safer options
|
g1smd

msg:4496468 | 11:39 pm on Sep 17, 2012 (gmt 0) |
You can alter it, but it might take Google some 3 to 6 months more to pick up those changes.
|
lucy24

msg:4496491 | 1:36 am on Sep 18, 2012 (gmt 0) |
Are you currently redirecting or going straight to 404/410? If you pull selected pages out of the 410 bin and start redirecting them, the first thing you will notice is Googlebot running around asking for all those other pages again, including the one's you'd thought it had finally managed to forget. Obviously it's checking to see whether any of the others is suddenly getting a fresh redirect. Ask how I know this. Ugh. Big mess.
|
kellyman

msg:4496561 | 6:18 am on Sep 18, 2012 (gmt 0) |
| Are you currently redirecting or going straight to 404/410? |
| Im redirecting everything after a name change, redirect went perfect, however 14 weeks in and rankings are very very slowly climbing, im still around 70% down from where i previously was its like Google has not seen what i have done as a 301 , its more like its moved the pages and seen it as a 302, hence why i changed my original PHP redirect to a Htaccess just in case there was something a miss somewhere I may just be unlucky and will have to wait a few more weeks / months for Google to push all the old juice over from the old site
|
phranque

msg:4496570 | 6:29 am on Sep 18, 2012 (gmt 0) |
| Im redirecting everything after a name change |
| have you checked your GWT account(s) for the old hostname(s) recently? i wonder if google is seeing a lot of "soft 404s"
|
kellyman

msg:4496582 | 7:39 am on Sep 18, 2012 (gmt 0) |
Hi phranque Just checked those and no, theres no soft 404's there at all All the 404's i see are what i would expect to see
|
lucy24

msg:4496584 | 7:49 am on Sep 18, 2012 (gmt 0) |
| All the 404's i see are what i would expect to see |
| Soft 404s will not be listed among the 404s. That's what "soft 404" means.
|
kellyman

msg:4496593 | 8:22 am on Sep 18, 2012 (gmt 0) |
yeah did check all errors and no soft 404's at all
|
phranque

msg:4496608 | 8:38 am on Sep 18, 2012 (gmt 0) |
there have been many posts recently about the accuracy and currency of GWT data so I woulld keep an eye on the soft 404s to see if they are reported later.
|
kellyman

msg:4496610 | 8:53 am on Sep 18, 2012 (gmt 0) |
Its been 14 weeks, I would have thought that if there was anything obvious it would have reared its ugly head by now, however i only implemented the new htaccess file just over a week ago so plenty of time to wait Looks like mine is going to go down to the wire and take the maximum it possibly can as that's my luck. I was thinking of adding some individual rules to my htaccess to try and force maybe the home page and maybe 1 or 2 of the others but will probably cause more harm than good
|
| This 50 message thread spans 2 pages: < < 50 ( 1 [2] ) |
|
|