PDA

View Full Version : [phpLD HTACCESS Rewriter] Mod


VSDan
01-22-2006, 11:01 AM
Description: Compiles a list of all categories and subcategories, and then assembles a list of category/subcategory-specific RewriteRules along these lines. You just have to copy and paste the script output (Rewrite lines) to your phpLD .htaccess file. Results in SEO-friendly categories / subcategories URLs.

Demo: http://www.monster-submit.com/directory/rewriter.php

Notes: Written in response to this thread {thread link no longer valid}

Download: http://www.monster-submit.com/phpld/


To download this and other VS mods, please go here : VS phpLD Mods (http://www.monster-submit.com/phpld/)

David
01-22-2006, 07:28 PM
Thank you for this, Dan! :D

VSDan
01-22-2006, 07:32 PM
You're welcome, David! Not much in terms of coding, but gets the job done =)

jtoddv
02-01-2006, 08:49 PM
Just wondering if this will this become an integral part of 3.0? So on creation of a new category the script will run to recreate the .htaccess file or is this not possible?

Bill
02-01-2006, 08:57 PM
Content visible to registered users only.

Not in yet, maybe as things are still being added to 3.0.

jtoddv
02-01-2006, 09:14 PM
Excellent, this is definietly an important part... Google hates seeing 404 errors as 200s.

Nictech
03-03-2006, 11:45 PM
Hey Dan,

I tried the rewriter and now all categories come up 404, had to turn off Enable URL rewrite in the admin.

I added rewriter.php to root, copied to .htaccess and boom i'm in a mess.

Any ideas?

Thanks

Bob

VSDan
03-03-2006, 11:52 PM
Hi Bob:

All you have to do to fix and restore back to the way it was, is to delete the lines you added. What does your .htaccess file look like after you added the extra Rewrite lines? Can you post the .htaccess file? You may have just added them incorrectly.

Nictech
03-04-2006, 12:01 AM
Wow! That was quik.

I just went through the process again and here are the first few lines since I have over 600 cats.

Content visible to registered users only.

Thanks

Bob

VSDan
03-04-2006, 03:37 AM
Hi Bob:

Do you have the modified .htaccess file in place? I ask because when I go to your site, I see SEO friendly category URLs - without 404.

Nictech
03-04-2006, 11:56 AM
Yes the .htaccess is default so the site will work.

I tried several changes all with the same result, when the rewriten .htaccess is uploaded the site will only show the latest links,submit etc. but no categories.

Please send me a quick note at bobATnictechdesigns.com and I will put the rewrite in place for you to view.

Thanks

Bob

amitpatel_3001
03-12-2006, 11:32 AM
Hello,

i was checking my .HTACESS File and dont know what happened and now all my categories show 404 error.
I mailed my HOST Support and get this reply.

Content visible to registered users only.

Currently i have disabled : Enable URL rewrite
So, the categories are being shown and i want to enable it.
I Have deleted the .HTACESS File currently so that my site opens.
Please help me.

gearoid
03-14-2006, 10:26 PM
I could not see anything but one incidence of "$lines" on VSDan's rewriter. It opened in Ms word.
Was there more, or can someone post it?
Thanks.

Thesee
04-01-2006, 10:54 AM
Good job but:

I think this is more performant:

Content visible to registered users only.
now, (sorry for my poor english :oops: )
But another question:
In your opinion, what is better:
1)
Make the script work with:
Content visible to registered users only.
so the redirect is done directly by Apache

2) same as above but we must create a GDBM or similar dbase so apache can lookup for redirect more efficiently?

jameslittle
04-09-2006, 11:40 PM
hi.
I was facing the same 404 problem with google.
So i downloaded the the mod and been able to get google to vefiry my sitemap. However, now I am facing problem as all my category pages are returning 404pages.

So, what should I do next? after getting google to verify the sitemap, should I restore the htaccess file to original stage?


James

anon
04-10-2006, 12:08 AM
Content visible to registered users only.

yes!

restore your htaccess once your sitemap is complete.

jameslittle
04-10-2006, 02:12 AM
GOT IT !!
Rock...it just Rock!! Thanks for the mod!! You have save my day!
I was having BIG headaches trying to figure out myself...almost jump off cliff!!

sincerely...thank millions for the mod!

james the little

Fred
04-13-2006, 06:32 PM
Hi after i added this mod all my symbolic categories dosent work any ideas...?

dontrustthisposter
08-28-2006, 10:44 PM
*edited*

Simple error had to remove the

Content visible to registered users only.

from .htaccess, hope this helps others.

I hope there will be a version soon that solves subcategories that no longer exist instead of just main categories.

Thanks.

mgrohan
09-14-2006, 01:54 AM
Great script after reading all the 404 problem posts on the forum i gave your script a try. Has solved the problem of no 404 errors for non-existant categories.

As the above poster, i'm wondering if it would be possible to make this work on sub-cats also?

VSDan
09-20-2006, 09:02 AM
Ask for, and ye shall receive. The [phpLD HTACCESS Rewriter] mod has been updated from 1.00 to 1.10. The mod now compiles SEO-friendly Rewrites for Top Level Categories AND Subcategories.

dontrustthisposter
09-21-2006, 03:02 AM
Content visible to registered users only.

Dan,

All my cats go 404 with this but work with the other version. Do you have this running somewhere?

VSDan
09-21-2006, 04:26 AM
Yep, here:

http://www.monster-submit.com/directory/Software/Browsers/Firefox/
(phpLD v3.05)

- but I do not think that this mod is required any more. This should suffice:

Content visible to registered users only.

- otherwise, when you right-click on page properties, what is page URL of 404 pages - or better yet, check your server error log.

dontrustthisposter
09-21-2006, 01:18 PM
Dan,

No that link is not working with the mod rewrite;

http://www.monster-submit.com/directory/Software/Browsers/NotaCategory (http://www.monster-submit.com/fmain.shtml?http://www.monster-submit.com/directory/Software/Browsers/NotaCategory)

http://web-sniffer.net/?url=http%3A%2F%2Fwww.monster-submit.com%2Ffmain.shtml%3Fhttp%3A%2F%2Fwww.monste r-submit.com%2Fdirectory%2FSoftware%2FBrowsers%2FNot aCategory&submit=Submit&http=1.1&gzip=yes&type=GET&ua=Mozilla%2F5.0+%28X11%3B+U%3B+Linux+i686%3B+en-US%3B+rv%3A1.8.0.7%29+Gecko%2F20060913+Fedora%2F1. 5.0.7-1.fc5+Firefox%2F1.5.0.7+pango-text+Web-Sniffer%2F1.0.24

This would be an essential mod for 2.0 or you could never move a subcategory without eventually getting deindexed like me, thanks again phpld:D.

And no on version 3 it is not foolproof I still have BS urls kicking off 200s and ( insult to injury ) had to remove some valid links due to invalid 404s.

ie;

http://www. free-website-directory. com/index.php?thispageshouldn'texistbutheritis

ie;

http://www. free-website-directory. com/latest-links.html

Ahh fun with phpld3.0:mad:

If I could go back in time with this mod working properly I never would have upgraded to 3.0 with this working I would. I have 2 other great directories and would like this to work with them as I wouldn't make the same mistake with them.

Thanks, I hope to see this working.

VSDan
09-21-2006, 11:01 PM
This mod is working in accordance to what it is supposed to do. So, I'm not clear on what you want it to also do.

mgrohan
09-23-2006, 01:03 AM
Thanks Dan.
Works great!! 404 errors returning properly on sub-categories now..

dontrustthisposter
09-23-2006, 10:09 AM
Content visible to registered users only.

I'd like it to show a 404 error for a subcategory that does not exist

ie;

http://www.monster-submit.com/directory/Software/Browsers/NotaCategory (http://www.monster-submit.com/fmain.shtml?http://www.monster-submit.com/directory/Software/Browsers/NotaCategory)

Maybe I'm misunderstanding this whole thing?

mgrohan
09-24-2006, 01:31 AM
Sounds like you are trying to get a custom 404 error page? If so see here: http://www.phplinkdirectory.com/forum/showthread.php?t=6036

I have tested both sites URLs (. free-website-directory. com + http://www.monster-submit.com/ (http://www.monster-submit.com/fmain.shtml?http://www.monster-submit.com/directory/Software/Browsers/NotaCategory)) with web-sniffer, and both return 404 error status on non existant pages on both categories and sub-categories.

dontrustthisposter
09-24-2006, 03:28 PM
Again....Here is a link to a non-existant page which websniffer says 200 OK

http://web-sniffer.net/?url=http%3A%2F%2Fwww.monster-submit.com%2Ffmain.shtml%3Fhttp%3A%2F%2Fwww.monste r-submit.com%2Fdirectory%2FSoftware%2FBrowsers%2FNot aCategory&submit=Submit&http=1.1&gzip=yes&type=GET&ua=Mozilla%2F5.0+%28X11%3B+U%3B+Linux+i686%3B+en-US%3B+rv%3A1.8.0.7%29+Gecko%2F20060913+Fedora%2F1. 5.0.7-1.fc5+Firefox%2F1.5.0.7+pango-text+Web-Sniffer%2F1.0.24

Maybe it's me? When you click on this link does it say 404? I'll email websniffer .

And for me again...

. free-website-directory. com/index.php?thispageshouldn'texistbutheritis

Maybe I'm just crazy, but if I am Google is too.

VSDan
09-24-2006, 07:25 PM
Non-existent directories come up as 200 instead of 404 because of the following phpLD out-of-the-box Rewrite lines:

## Category redirect
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php [QSA,L]

Removing those while maintaining the mod Rewrite lines will "category redirect" for cats/subcats that exist in the phpLD database, but 404 for those that are not.

Isabel
11-19-2006, 10:52 PM
Hello.

The sample here http://www.monster-submit.com/directory/rewriter.php
is not the same I had downloaded from your page (file rewriter.php)
In your page is a older version.

My file:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^/hogar/(.*) index.php
RewriteRule ^/hogar/casa/(.*) index.php
RewriteRule ^/hogar/jardin/(.*) index.php
RewriteRule ^/hogar/cocina/(.*) index.php
RewriteRule ^/negocios/(.*) index.php

Your sample file:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^Affiliate_Programs/$ index.php
RewriteRule ^Affiliate_Programs/page-(.*)$ index.php?p=$1
RewriteRule ^Affiliate_Programs/Affiliate_Management_Software/$ index.php
RewriteRule ^Affiliate_Programs/Affiliate_Management_Software/page-(.*)$ index.php?p=$1
RewriteRule ^Affiliate_Programs/Affiliate_Networks/$ index.php
RewriteRule ^Affiliate_Programs/Affiliate_Networks/page-(.*)$ index.php?p=$1

ambition13
11-22-2006, 03:43 PM
I just installed this mod, and it is 404ing everthing but the home page, including my actual existing categories. Anyone know how to fix that?

VSDan
11-22-2006, 07:45 PM
Hi:

I've revised the mod. Download the new one from phpLD_Vault, and try it.

Blastom
11-28-2006, 01:58 AM
Hei Dan. I have paid the 10$ and got a membership on your site. I mostly needed you rewiter. I downloaded it and used it. This is my problem, and I needed fixed fast:
http://www.mygreencorner.com/Computers_and_Internet/Programming_and_Development/ is working
http://www.mygreencorner.com/Computers_and_Internet/Programming_and_Development is not working. :(

VSDan
11-28-2006, 03:50 AM
Content visible to registered users only.

Hi:

If the mod is producing Rewrites with URL's missing trailing forward slash, then edit rewriter.php by changing all 3 incidences of:

Content visible to registered users only.

to

Content visible to registered users only.

For example:

Content visible to registered users only.

becomes:

Content visible to registered users only.

Blastom
11-28-2006, 09:24 AM
:) What I wanted to say is that, the cats and subcats in the tree I want them to be accessed both with "/" or without "/".
For example, I want to work:
http:/www.mygreencorner.com/Computers/ and
http:/www.mygreencorner.com/Computers too.

VSDan
11-28-2006, 09:40 AM
Ahhh, I see what you mean now after I tested on our server. I've updated the mod. Try the new one.

Blastom
11-28-2006, 10:05 AM
Well, I've done it by hand (1h :D, because I didn't see the reply :P). For each set:
RewriteRule ^Affiliate_Programs/$ index.php
RewriteRule ^Affiliate_Programs/page-(.*)$ index.php?p=$1
I have added:
RewriteRule ^Affiliate_Programs$ index.php
Thank you Dan.

thompson
02-06-2007, 01:46 PM
have the same problem with latest-links.html. is there anywhere a solution for that ?

dynn
02-24-2007, 11:54 AM
Dan,

I've try this at my dir www.urlmoz.com ,unfortunately it does'nt work.I'm using phpld2.1.

Here is part of my .htacces.

Content visible to registered users only.

MrOrange
05-26-2007, 02:51 PM
Same problem here.. Google is getting all lost on my site.

Ive gone through my source code and cant find how its getting lost.

Anyway, i modified a sitemap script from here to make the rewrite rules.. all working now returning 404's.

Finally google will be happy :)