Gossamer Forum
Home : Products : Gossamer Links : Discussions :

How to remove index.html at the end of each category URL and how to move the pages location from default "pages" folder

(Page 1 of 2)
> >
Quote Reply
How to remove index.html at the end of each category URL and how to move the pages location from default "pages" folder
Hi,

Two questions.

1. How to remove /index.html from all internal links pointing to categories. Example all internal links right now point to www.example.com/pages/category-example/index.html, and I would like them to point to www.example.com/pages/category-example/

2. All pages are located in www.example.com/pages folder. How can I change the location to www.example.com/. For example instead of www.example.com/pages/category-example, I would like them to be located in www.example.com/category-example

Thank you,

Z
Quote Reply
Re: [Z] How to remove index.html at the end of each category URL and how to move the pages location from default "pages" folder In reply to
Hi,

In Setup > Build Options , change build_index_include to "No", and that will stop it putting /index.html at the end of your URL's

Quote:
2. All pages are located in www.example.com/pages folder. How can I change the location to www.example.com/. For example instead of www.example.com/pages/category-example, I would like them to be located in www.example.com/category-example

Mmm, well the moving is simple - you just change the paths/URLs in Setup > Paths & URLs . But if you already have those pages indexed, you would need to add a rewrite rule to send people to the new folder (so you don't loose traffic, or get Google reporting you for duplicate content);

Code:
RewritRule ^pages/(.*)$ http://www.yoursite.com/$1 [R=301,L]

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How to remove index.html at the end of each category URL and how to move the pages location from default "pages" folder In reply to
Andy wrote:

Code:
RewritRule ^pages/(.*)$ http://www.yoursite.com/$1 [R=301,L]

Hi Andy,
is this line enough for all my existing categories or do I have to write a line for each of my categories.
Would be a long list :-(

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] How to remove index.html at the end of each category URL and how to move the pages location from default "pages" folder In reply to
Hi,

That should work for *anything* in the /pages/ folder.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How to remove index.html at the end of each category URL and how to move the pages location from default "pages" folder In reply to
Hm, I have my detailed pages not in folders but in root.
But I thought I have to tell google that there are no pages
domain.com/category/index.html

Why does the rewrite rule work with pages?

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] How to remove index.html at the end of each category URL and how to move the pages location from default "pages" folder In reply to
Hi,

Give me a real example of your old + new category URL's, and detailed URLs... and I'll take a look

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How to remove index.html at the end of each category URL and how to move the pages location from default "pages" folder In reply to
Hi Andy,
I changed build_index_include to "No"

My old categories looked like this
Code:
domain.com/category/index.html
the new categories look like
Code:
domain.com/category/

My detailed pages look like this
Code:
domain.com/Title_D15645.html

At the moment I still can call
Code:
domain.com/category/index.html
AND
domain.com/category/
So I will get a google duplicate pages problem...

Thanks

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] How to remove index.html at the end of each category URL and how to move the pages location from default "pages" folder In reply to
Hi,

For the category pages, if you no longer use index.html at the end - type:

Code:
RewriteRule ^(.*)/index\.html http://www.site.com/$1/ [R=301,L]

In this example, it would move site.com/foo/index.html to site.com/foo/

Hope that helps Smile

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How to remove index.html at the end of each category URL and how to move the pages location from default "pages" folder In reply to
Hi Andy,
I just found this in my htacces file. Can I quit this line?
Code:
RewriteRule ^(.*)/index\.html$ /cgi-bin/unterricht/page.cgi?g=$1/index.html [L]

Thanks

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] How to remove index.html at the end of each category URL and how to move the pages location from default "pages" folder In reply to
Yup

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How to remove index.html at the end of each category URL and how to move the pages location from default "pages" folder In reply to
So now there seems to be only two problems left.
My subcategories still have the /index.html ?
And my breadcrumbs still have index.html, too?

I just looked into subcategory.html and I found
Code:
<%escape_html URL%>
But I don't know how to quit the index.html

Matthias
gpaed.de
Quote Reply
Re: [Andy] How to remove index.html at the end of each category URL and how to move the pages location from default "pages" folder In reply to
Hi Andy,
the problem with the subcats is solved, when I leave this part in the htaccess
Code:
RewriteRule ^(.*)/index\.html$ /cgi-bin/unterricht/page.cgi?g=$1/index.html [L]

???

Matthias

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] How to remove index.html at the end of each category URL and how to move the pages location from default "pages" folder In reply to
Hi Andy,
stop thinking about this problem :-)
The shock of loosing half of my categories, stopped me from playing around with the code, just for SEO.
I just went back to my old settings and everything is fine again ;-)

Matthias
gpaed.de

Last edited by:

Matthias70: Oct 19, 2011, 11:23 AM
Quote Reply
Re: [Matthias70] How to remove index.html at the end of each category URL and how to move the pages location from default "pages" folder In reply to
haha np

Just FYI, the reason it was still showing index.html at the end of the URLs in breadcrumbs etc, was probably due to the fact you didn't change the setting I mentioned here: http://www.gossamer-threads.com/...der_P311056/#p311056

You may also have got some globals that had index.html hard-coded into them :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How to remove index.html at the end of each category URL and how to move the pages location from default "pages" folder In reply to
Hi Andy,
I think I followed all steps and I searched all globals.
Now I will wait what Z (the threadstarter) says.
Maybe after this I will try it again ;-)
Thanks

Matthias
gpaed.de
Quote Reply
Re: [Andy] How to remove index.html at the end of each category URL and how to move the pages location from default "pages" folder In reply to
Thank you Andy. The build_index_include no option worked great and it was very simple.

Changing the path seems to be simple as well. However the problems that might arise from redirecting setup, pages not being indexed, or loosing pages PR, will make me prepare this change very, very, carefully.
Quote Reply
Re: [Z] How to remove index.html at the end of each category URL and how to move the pages location from default "pages" folder In reply to
Hi,

If you have the 301 redirect setup, then there is no reason you will loose the PR on pages, nor the indexing of them. I use 301's all the time, and never have any SEO issues Smile

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How to remove index.html at the end of each category URL and how to move the pages location from default "pages" folder In reply to
I decided not to use redirects. Google will eventually crawl the new pages. I'm not in a rush Smile
Quote Reply
Re: [Z] How to remove index.html at the end of each category URL and how to move the pages location from default "pages" folder In reply to
Hi,

You need to use the 301 redirects, or google will think you have duplicate content ;) This gives an idea about why its important to do this: http://youtu.be/Cm9onOGTgeM

Cheersz

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How to remove index.html at the end of each category URL and how to move the pages location from default "pages" folder In reply to
But I deleted all pages in the old folder, why would Google think it is duplicate if the pages are not there anymore?
Quote Reply
Re: [Andy] How to remove index.html at the end of each category URL and how to move the pages location from default "pages" folder In reply to
Ok I understand now that 301 redirect needs to happen.

There are 2 things to redirect though.
From www.example.com/pages/Example_Category to www.example.com/example_category (pages folder removed and uppercase removed)

I created .htaccess file with the content below and placed it to the web root but it didn't work

RewriteEngine on
RewriteMap lowercase int:tolower
RewriteRule ^/pages/(.*) /${lowercase:$1} [R=301,NC]

I get this error
----------------------------------------------------------------------------------------------------------------------------------
Internal Server ErrorThe server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log.
----------------------------------------------------------------------------------------------------------------------------------

Any recommendations?

Last edited by:

Z: Oct 20, 2011, 8:47 PM
Quote Reply
Re: [Z] How to remove index.html at the end of each category URL and how to move the pages location from default "pages" folder In reply to
Z wrote:
But I deleted all pages in the old folder, why would Google think it is duplicate if the pages are not there anymore?

Because they would be seen as 404's then, and thats NOT a good thing to have Whistle

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Z] How to remove index.html at the end of each category URL and how to move the pages location from default "pages" folder In reply to
Hi,

It could be that you are getting into an infinate loop.

Try this:

Code:
RewriteMap lowercase int:tolower
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule ^/pages/(.*) /${lowercase:$1} [R=301,NC]

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How to remove index.html at the end of each category URL and how to move the pages location from default "pages" folder In reply to
Got the same error across the website, can't access any pages until I rename file to .htaccess-temp

I'm placing this file in the root of the website (same place where index.html is). Is that the right location.
Also I'm naming it .htaccess

Any other suggestions?
Quote Reply
Re: [Z] How to remove index.html at the end of each category URL and how to move the pages location from default "pages" folder In reply to
Do you have access to error logs on your server? If so, it may give you some more information on whats going on there

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
> >