Category to Directory

Discuss practical ways rearrange URLs using mod_rewrite.

Category to Directory

Postby pushpinderbagga » Tue Jul 21, 2009 7:31 pm

hello ....

I save my pictures as

http://www.okidda.com/pictures/solar-ec ... 9-6667.jpg

but the url

http://www.okidda.com/ABCD is the category page

so automatically google image bot sees my

http://www.okidda.com/pictures also as a category page and gets an error...

probably why it doesnt index my pics also...

am I wrong somewhere or can we correct this in some way ?
pushpinderbagga
 
Posts: 36
Joined: Fri May 22, 2009 9:43 pm

Postby richardk » Wed Jul 22, 2009 9:58 am

Try adding
Code: Select all
RewriteCond %{SCRIPT_FILENAME}/ -d
RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]

after
Code: Select all
RewriteEngine On
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

whats the purpose

Postby pushpinderbagga » Wed Jul 22, 2009 10:22 am

hello richardk

could you please tell me what the code does ?

I could not understand it :(
pushpinderbagga
 
Posts: 36
Joined: Fri May 22, 2009 9:43 pm

Postby richardk » Wed Jul 22, 2009 10:53 am

It adds trailing slashes to directories. So the request to /pictures will be redirected to /pictures/.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

how does that help...

Postby pushpinderbagga » Wed Jul 22, 2009 10:58 am

I mean even after adding trailing slashes to directories...

we ping
Code: Select all
http://www.okidda.com/pictures/


giving us

table 'okidda.pictures' doesn't exist
pushpinderbagga
 
Posts: 36
Joined: Fri May 22, 2009 9:43 pm

Postby richardk » Wed Jul 22, 2009 11:24 am

That script is not well written. It should produce a better error.

Instead of
Code: Select all
RewriteCond %{SCRIPT_FILENAME}/ -d
RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]

try
Code: Select all
# Stop processing if it's a request to a directory.
RewriteCond %{SCRIPT_FILENAME}/ -d
RewriteRule .* - [L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

done

Postby pushpinderbagga » Wed Jul 22, 2009 11:37 am

dine...

gives a page no found error...

hope it doesnt affect indexing images in the directory :D
pushpinderbagga
 
Posts: 36
Joined: Fri May 22, 2009 9:43 pm

Postby richardk » Wed Jul 22, 2009 3:41 pm

dine...

??

gives a page no found error...

hope it doesnt affect indexing images in the directory

I don't see why it would.

You could try adding
Code: Select all
Options +Indexes
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

typo

Postby pushpinderbagga » Thu Jul 23, 2009 12:32 am

I meant DONE... :D

richardk

Code: Select all
Options +Indexes


will throw open the directory ... I will let it remail

Code: Select all
Options -Indexes


and see .. if there is any issue indexing in recent time... I will get back...

thanks a ton !
pushpinderbagga
 
Posts: 36
Joined: Fri May 22, 2009 9:43 pm

Postby richardk » Thu Jul 23, 2009 9:08 am

If you don't want a directory listing, you could crate an index file instead.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Next

Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 19 guests

cron