Forum Moderators: phranque

Message Too Old, No Replies

troubleshoot .htaccess directoryindex

         

gomblue

12:44 am on Jul 12, 2007 (gmt 0)

10+ Year Member



I've been using the following two commands in a .htaccess file at http://www.example.com/.htaccess

1)
DirectoryIndex index.html /Merchant2/merchant.mvc?Store_Code=X&Screen=HOME

2)
ErrorDocument 404 /Merchant2/merchant.mvc?Store_Code=X&Screen=HOME

They work great.

But, I now want the following four addresses to go to:

http://www.example.com/support/supporthomepage.htm
or else
http://www.example.com/support/index.htm

1) example.com/support
2) example.com/support/
3) www.example.com/support
4) www.example.com/support/

The DirectoryIndex command is forcing those four to go to:
/Merchant2/merchant.mvc?Store_Code=X&Screen=HOME

Can anyone help me? I hope this is clear enough.

[edited by: jdMorgan at 5:44 pm (utc) on July 12, 2007]
[edit reason] example.com [/edit]

g1smd

1:08 am on Jul 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You need an extra .htaccess file inside the /support/ folder to set that up.

However, I am gagging on the fact that you use a URL like /Merchant2/merchant.mvc?Store_Code=X&Screen=HOME as an index page.

I am further astounded that you show the same page as your 404 Error page.

This is a house of cards waiting for the wind to start blowing, I think.

gomblue

4:25 pm on Jul 12, 2007 (gmt 0)

10+ Year Member



1) What would be the contents of the .htaccess file that should be used in the /support/ folder?

2) Why is this a problem (it seem to work fine):

(using a URL like /Merchant2/merchant.mvc?Store_Code=X&Screen=HOME as an index page.

and using the same page as a 404 Error page.)

This is a house of cards waiting for the wind to start blowing, I think.)

Thank you for your help.

jdMorgan

5:55 pm on Jul 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The comment about "a house of cards" is likely addressed to the fact that the most successful and highly-ranked sites do not use long dynamic URLs with query strings. It is known that search engines arbitrarily limit the depth to which they spider sites with such URLs, and that they really don't handle more than two query parameters very well. They are improving, but the current state of the art is such that static-looking URLs are recommended if search ranking is important for a site.

Therefore, we see a lot of interest here in the subject of "Search engine friendly URLs" -- converting sites to publish static-looking, short, keyword-related URLs in links on their pages, and then using mod_rewrite and other techniques to 'map' these URLs, when requested from the server, back to the form needed by the sites' page-generation script(s).

Our purpose in this forum is to discuss Apache-related topics; While we'll be happy to help you get your code working, we cannot support the demand for a "free code-writing service" here. The documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com] may be useful to help get you started.

We often have threads on rewriting and/or redirecting dynamic URLs or URLs with query strings. A site search focused on those keywords will doubtless turn up some examples specific to your questions.

Jim

gomblue

8:36 pm on Jul 12, 2007 (gmt 0)

10+ Year Member



Thank you for your help.

gomblue

10:46 pm on Jul 12, 2007 (gmt 0)

10+ Year Member



Jim,

"We often have threads on rewriting and/or redirecting dynamic URLs or URLs with query strings. A site search focused on those keywords will doubtless turn up some examples specific to your questions."

If you reread my question, that isn't exactly what I'm trying to do.

I'm trying to get x.com/support to go to www.x.com/support/thisfile.htm (given my current .htaccess file at x.com/.htaccess).

Given, you are stressing that this forum isn't a "free code-writing service", is there another forum here at WebmasterWorld where it is appropriate for me post questions for this type of information?

Otherwise, can you suggest a website or two where I can pay to get basic questions like this answered for a reasonable cost? Something where you can purchase points/tokens and use them to get support services?

Thank you

nickCR

10:55 pm on Jul 12, 2007 (gmt 0)

10+ Year Member



You could try a service like script lance or one of those places.

jdMorgan

11:39 pm on Jul 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



.htaccess is a per-directory configuration file, so try this at example.com/support/.htaccess

DirectoryIndex /support/supporthomepage.htm

The other part of the "house of cards" is that 404 errors should be handled by a page that says there was a missing page error, and you should then offer the site map, related category page, and/or the index page as links. This avoids having your error page and your index page flagged for duplicate content. It also avoids confusing the heck out of your visitors, who will otherwise likely click the "bad" link several times in a row, trying to figure out how they got to your home page. It's a usability, customer retention, and SEO issue...

Jim

gomblue

12:25 am on Jul 13, 2007 (gmt 0)

10+ Year Member



That worked Jim. Thank you. I'll consider changing the 404 landing page as well.