Welcome to WebmasterWorld Guest from 18.207.137.4

Forum Moderators: Ocean10000 & phranque

Message Too Old, No Replies

mod rewrite limitation?

anyone help with this

     
4:43 pm on Sep 5, 2003 (gmt 0)

Full Member

10+ Year Member

joined:May 14, 2003
posts:215
votes: 0


Ok, i got mod_rewrite working.
I got it go from A ID=1 to a /catergory1

i renamed catergory1 to /category2, now the problem is, google seem to go spider /catergory1 again and what happens is that it brings it up the the homepage instead.

My thinking is now ,it assumes /category1 which doesnt exist anymore is a duplicate of the main homepage.
So now it has taken off the homepage off the index.

Hope you can understand what i mean, take a look and try it if u want.

What can i do to fix this problem?

A big problem is that you can type any catergory eg www.domain.com/dir/something/ and it will bring up the homepage.

Should i make this go to 404 to show it doesnt exist.
If i should , how? cos i have no idea how to program it?

thanx in advance!

5:19 pm on Sept 5, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


penfold25,

It sounds like maybe you used an external (301 or 302 redirect) instead of an internal redirect, or maybe you've got the rewrite function backwards - I can't tell from what you've posted.

If you want better help, it might be a good idea to post the rewrite code that you used, along with the desired URL translation and any required exclusions.

Jim

5:39 pm on Sept 5, 2003 (gmt 0)

Full Member

10+ Year Member

joined:May 14, 2003
posts:215
votes: 0


This is some information from htaccess, .
It all works fine, perfect, the way i wanted it, except some problems occur as below

RewriteRule ^$ dir/ [R=301,L]
RewriteRule ^search/$ dir/ [R=301,L]

RewriteCond %{QUERY_STRING} ^search=cat&category=*
RewriteRule ^search/search.php$ redir-cat.php [L,QSA]

RewriteCond %{QUERY_STRING} ^Terms=* [OR]
RewriteCond %{QUERY_STRING} ^search=*
RewriteRule ^search.php$ redir-search.php [L,QSA]

i add the directory name eg /education , in a php file, add to this file when i make a new directory etc.

Wen i renamed a directory
, i changed this in the php file which was fine, so it produced the change on the site.

However google had already spidered the old catergory

All the previous spiders worked good till now.

Google look from the old catergory, i thought it would produce a 404, however it does not, it produces the homepage.

Im assuming google thought this was a duplicate copy and so has removed the index file from its db.

Try this go to my site in profile, type www.domain.com/dir/anything

and it produces the homepage? why?

all the other directories work exactly as i have set them from a php file someone set up for me.All i do is add to it when i add another directory.

what could i do so it to produce a 404 page for this?
what u this i should do

6:04 pm on Sept 5, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


In your post, I see redirects *to* /dir, but I don't see a redirect *from* /dir to your script. In order to get help, you'll need to present a consistent, clear picture of how your site works. Otherwise, it's hard to understand how it is supposed to work, never mind why it might not work...

It sounds to me like your scipt will serve the home page if it does not find the requested category. Look at the script first.

One note: This rule
RewriteCond %{QUERY_STRING} ^Terms=* [OR]

will accept a query_string of "Terms<anything>", "Terms=<anything>", "Terms==<anything>" or even "Terms==========<anything>"

In mod_rewrite regular-expressions, a "*" means "accept any number of the previous character or group, including zero." I would guess that you should remove the "*" from those lines.

Ref: Introduction to mod_rewrite [webmasterworld.com]

Jim