The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 22, 2019, 11:46:23 PM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Mod Rewrite Emergency... HELP!!! need some htaccess rewriting.. fast...  (Read 3042 times)
tommytx
Expert
****
Offline Offline

Posts: 123


View Profile WWW
« on: October 16, 2013, 04:23:13 PM »

How I got to this point:
Google is eating my lunch I hope I can get an answer tonight...
Due to leaving out a quote on the linkedin button.. it attached itself to every url on that page..
I have fixed the problem but google now has that crap on his list and is crawling each one right
as we speak.. so this is urgent.. I am sure google has me scheduled for a ton of 404 in my toolbox
for tomorrow... but I need to stop it now.. before he gets pissed off with too many 404.. plus none
of these pages are getting indexed..
So Bottom line I need to Rewrite to get rid of the www.linkedin.com/in/vickimoore/ at the end of each URL.

Code:
66.249.73.60  Wednesday, 16 October 2013 06:52 pm|/a-house-of-memories-character-charm/www.linkedin.com/in/vickimoore/
66.249.73.60  Wednesday, 16 October 2013 06:53 pm|/five-guys-coming-to-bay-meadows/www.linkedin.com/in/vickimoore/
66.249.73.60  Wednesday, 16 October 2013 06:54 pm|/san-mateo-home-buyers-calm-down/www.linkedin.com/in/vickimoore/
66.249.73.60  Wednesday, 16 October 2013 06:54 pm|/activity-picks-up-at-bay-meadows/www.linkedin.com/in/vickimoore/
66.249.73.60  Wednesday, 16 October 2013 06:55 pm|/20-great-places-to-eat-in-pacific/www.linkedin.com/in/vickimoore/
66.249.73.60  Wednesday, 16 October 2013 06:55 pm|/3-ways-to-beat-out-the-other-buyers/www.linkedin.com/in/vickimoore/
66.249.73.60  Wednesday, 16 October 2013 06:56 pm|/hiller-museum-has-your-summer-covered/www.linkedin.com/in/vickimoore/
66.249.73.60  Wednesday, 16 October 2013 06:57 pm|/will-real-estate-market-insanity-last/www.linkedin.com/in/vickimoore/
66.249.73.60  Wednesday, 16 October 2013 06:57 pm|/san-mateo-median-house-prices-q3-2008/www.linkedin.com/in/vickimoore/
66.249.73.60  Wednesday, 16 October 2013 06:57 pm|/san-mateo-real-estate-fact-or-fiction/www.linkedin.com/in/vickimoore/
66.249.73.60  Wednesday, 16 October 2013 06:57 pm|/how-much-deposit-do-you-put-down-1-2-3/www.linkedin.com/in/vickimoore/


So bottom line what I need emergency help with is to remove anything beyond the www.so that google will index and
not keep getting the 404 thingy.. I have included two other redirects in place just to show you more that I am doing
as we speak.. I have annotated what each does just for info.. however they are not related to this request..
Below is the full data in my htaccess file..

The orig is an eaample of what google sees... w/o redirect..
The fwds is the way I want the url to look when it hits the site.
Simply remove the www.link stuff at the end leaving the last /


orig -> mydoman.com/sibbys-san-mateo/www.linkedin.com/in/vickimoore/
fwds -> mydoman.com/sibbys-san-mateo/

Need to know what to make this redirect look like.
RedirectMatch 301 blog(.*) $1


The code from here on has nothing to do with the problem but just shows some other redirects I have in place..
In other words I know how to do basic redirect but cannot figure the one above out..

Code:
Here i am simply removing the word blog from the url.. works fine...
***************************************************************
orig -> mydomain.com/blog/another-blog-article/
Fwds -> mydomain.com/another-blog-article/

RedirectMatch 301 blog(.*) $1


Here I am simply removing the word property from the url.. works fine..
***********************************************************************
orig -> mydomain.com/property/another-home-for-sale/
Fwds -> mydomain.com/another-home-for-sale/

RedirectMatch 301 property(.*) $1


This is the routine wordpress junk.. works fine..
**************************************************

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
« Last Edit: October 16, 2013, 04:27:20 PM by tommytx » Logged
Bompa
Administrator
Lifer
*****
Offline Offline

Posts: 564


Where does this show?


View Profile
« Reply #1 on: October 16, 2013, 07:00:42 PM »

Hi tommy,

I don't do this very often, so, I am not 100% sure, but something like this...

Code:
RewriteCond %{REQUEST_URI} (\/sibbys-san-mateo\/)www\.linkedin\.com\/in\/vickimoore\/
RewriteRule .* %1 [R=301,L]

The parentheses in the RewriteCond should capture what you want.

In the RewriteRule, I always forget if the captured data is in $1 or %1


Bompa
Logged

"The most beautiful and profound emotion we can experience is the sensation of the mystical..." - Albert Einstein
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #2 on: October 16, 2013, 08:15:51 PM »

That looks good Bomps except that it is a $ for RewriteCond/Rule, just checked some of mine that do something similar.

Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #3 on: October 16, 2013, 08:22:36 PM »

Actually you can do it in just a single Rule I believe...

RewriteRule (.*)/www\.linkedin $1 [P,L]

I can't check it right now but I think something like that will do it. Turn on rewrite logging to watch to see what you're rewriting to.

And. Bomps, I think you're right about % when using it across a Cond->Rule and just $ when using it on JUST the Rule.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
tommytx
Expert
****
Offline Offline

Posts: 123


View Profile WWW
« Reply #4 on: October 16, 2013, 09:25:26 PM »

Well its after midnight.. and I turned into a pumpkin.. but I got what you guys did... thanks a lot... will try this tonight and let you know tomorrow....
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #5 on: October 16, 2013, 09:39:59 PM »

As a side note, Tommy, all of my websites (ALL of them) modrewrite into a single PHP file, which I then translate into an action. Since everything flows through a single executable, I can do anything I want to - WAY more powerful than modrewrite.

So for example:
www.my-awesome-site.com/really-good-SEO-URL.html

would get modrewritten to
main.php?url=/really-good-SEO-URL.html

main.php then has a whole variety of things it does - checks the country, checks if it's a spider, checks a DB table for a known translation, sees if it should be 301 or 302'd ... any number of things. most often it's a DB translation to something like this:

/simpleFile.php?file=/www/sites/content/reallyBitchinSite/actualFile.html

... then main.php echos out that file and dies. Or faster is to do a simpleInclude.php which includes a PHP file - this works REALLY well if you use APC, because the file will now be RAM-cached and compiled rather than having to do an OS lookup. I can post it all if you'd like to take a look. It would have given you a really straightforward mechanism to handle it. (ModRewrite can be a bit arcane and troublesome at times if you get too tricky, IMO)
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
tommytx
Expert
****
Offline Offline

Posts: 123


View Profile WWW
« Reply #6 on: October 17, 2013, 07:10:34 AM »

Would love to see it... can you pm it.. or send under cover... as it could give one more ahole.. some ideas on how to get into your server... its sad but every tiny bit of info gives some idiot ideas..
And I do so very much of this.. for example i may already be doing some thing similar.. with this...

Rewrilte (.*) /work/index.php
I can do damn near anything I want while its in the work file.. and then leave off the (L) meaning last so that it returns to the htaccess and now does what they want but the url may be totally tampered with...


I specialize in transferring sites for free for folks... and have some extensive programs to help....
For example you can have a site with 50,000 pages indexed and you move to a new idx and the url for the 50,000 detail pages are totally different for the same MLS number on the new idx... it auto translates the old url to the new url on the fly...
for example...
orig IDX   mydomain.com/idx/mls-123456789-1324-ransom-road-norfolk-va-234567   the last is zip
new ids   mydomain.com/property/mls_123456789_ransom-road-1324_norfolk_va_234567   the last is zip

look at the drastic differences in urls... and they both must point to the same MLS number... its all done on the fly.

I have gotten pretty good at this but still have to rely on your team for the hard stuff....
IF anyone is in the process of transferring a domain.. they should never attempt such a feat without experienced help..... I am on facebook as Tom Chambers and get these kind of emails every day...

Quote
Axmxy Sxhrxxxader
Tom, this message went to my "other" folder. I wish I had seen it earlier. I have totally screwed up creating the subdomain on my site. All my links are 404 errors and even the new ones I try to create give me a 404. Aarrrggg
The above is when transferring a site to idxbroker where the idx has to be set up on a subdomain..

Anyone interested in how serious a transfer without competent help can see an article here ... read it before you make it more painful on yourself than it needs to be...  Everything I do is totally free and i have a thousand fans that will back that statement... Not a scam...
Here is the link... that can save your bacon..
http://vipteamwa.com/iggytom/index.php?dat=movesite

And even if you know how to move a site.. why do it when its free...
Logged
Bompa
Administrator
Lifer
*****
Offline Offline

Posts: 564


Where does this show?


View Profile
« Reply #7 on: October 17, 2013, 02:48:33 PM »

I specialize in transferring sites for free for folks... ...

And even if you know how to move a site.. why do it when its free...


I'm impressed.  I think soon you will be the go-to-guy for htaccess.

 Nerd

Bompa
Logged

"The most beautiful and profound emotion we can experience is the sensation of the mystical..." - Albert Einstein
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!