default page redirection (Linux,Apache)

Hi,
we have this problem:
Our main page is located at:
www.domainxy.com/us/indexp.phpI
In this "us" folder we have other pages too like contact, about us, products etc..

The site also contains the other folders like"uk", "ca", "de" (example:www.domainxy.com/de/indexp.php) - but we want to keep those intact.

We would like our default page to be:
www.domainxy.com/index.php 
or even better www.domainxy.com/index.html

When we asked our programmer to do that he said that it can be done however there will be some performance drawback.

So what would the best way be to achieve this (Apache, htaccess)?
Of course we are looking for a permanent redirection here (for the pages in the "us" folder only).

We heard that from the seo perspective it would be more preferable to have our main default page under our main domain (not in the folder).

Thank you.

J.
janimeAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ZShaverCommented:
there wont be any performance drawback, i dont know what your programmer is talking about, sounds lazy to me.
you can set apache to parse any file extension you want, and this will certainly work for .html as php will only parse the areas that contain php code

the only performance drawback i can imagine will come when you are serving up actual pure-html pages that contain PHP code, as PHP will be invoked to try to process the files, but this is on the order of milliseconds and wouldn't be noticable unless you were serving a very high volume of pages

and if you want your main page to be
www.domainxy.com/index.php or index.html rather

if you want you can just have this page redirect to the US page
either via include
include('us/indexp.php');
or by header redirect
header("Location: us/indexp.php");
0
theSAPPHIRECommented:
I think your programmer is thinking re-directing.

But, it sounds like a simple "pointer" task, where you have your domain name stored..

- normally you tell your domain, to go to http://www.domainxy.com as the main domain name, but it's pointer is told to go to, http://www.domainxy.com/us, and you also select, mask url, so it keeps the http://www.domainxy.com in the browser.

- another way, the .htaccess file can be used for instant redirect within your domain, to point directly to the /us/index.php file as the "main" website, but keep showing http://www.domainxy.com as the main display name.

let us know if that helps

-sapphire
0
COBOLdinosaurCommented:
I would just use .htaccess

Something like this will make php the handler for html; so you can use an .html extension, and it will do a simple 301 re-direct which is the method preferred by search engines.

The total overhead cost is miniscule and will not affect performance.

<Files .htaccess>
order allow,deny
deny from all
</files>
RemoveHandler .html
AddType application/x-httpd-php .html
Redirect 301 www.domainxy.com/us/indexp.phpI www.domainxy.com/index.html

Open in new window


Cd&
0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

Tony McCreathTechnical SEO ConsultantCommented:
From the seo perspective is is preferable that you use the domain.

You want to avoid duplicating your pages. So a scenario when the following show the same content is bad:

www.domainxy.com/index.php
www.domainxy.com/index.html
www.domainxy.com/

So you want to pick one and religiously stick with it.

The problem with picking index.php is that many people and systems will not use that in links to your website. They'll just use the domain. So you either have a duplicate problem or are causing redirects to resolve the issue.

So its best to make sure the domain itself represents a valid page (no redirects) and that you don't let people access duplicate versions of it.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
janimeAuthor Commented:
Ok, I understand, we decided to go with html extension and stick with it (hope it's a good decision).

On our site, for example in the footer ->when I hover above the links I can see the urls showing formats:
www.domainxy.com/us/index.html or www.domainxy.com/us/contact.html

Now what puzzles me I know I can set the permanent redirection (via cPanel) from  www.domainxy.com/us/index.html  to www.domainxy.com/index.html

however this won't change the links on our site though, or am I mising something here?
I can see that the links are not hard-coded in our pages.They are generated by php or htaccess file.

This is how our htaccess file looks now:

#
Options +FollowSymlinks
RewriteEngine on

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

RewriteRule ^admin/$ admin/index.php [NC,L]

RewriteRule ^([a-z]+)/([a-z0-9-/]+).html$ index.php?lang=$1&url=$2 [NC,L]

RewriteRule ^([a-z]+)/$ index.php?lang=$1 [NC,L]

### secure
RewriteRule ^files/secure http://www.domainxy.com [L,R=301]
RewriteRule ^files/secure/zip http://www.domainxy.com [L,R=301]

RewriteRule ^files/bckp http://www.domainxy.com [L,R=301]
#

So I assume that we will have to change the generated links first. Where should this be done - in our PHP or htaccess code?

Thanks.
J.
0
COBOLdinosaurCommented:
The links in the pages are being generated by the php.

.htaccess does not do anything to page code, it just passes directives to the server, to tell it how to parse the request, and respond.


Cd&


0
Tony McCreathTechnical SEO ConsultantCommented:
You want to avoid having the links on your page causing redirects. Get them fixed if you can.

Redirects slow down the users experience, lose some link juice (PageRank) and may give a bad impression to the search engines.

Also check if your system adds canonical tags to the head section of pages. You also don't want this to conflict with the URLs your using or any redirects.
0
torakeshbCommented:
0
janimeAuthor Commented:
Our programmer added to htaccess this line:

RewriteRule ^([a-z]+)/$ index.php?lang=$1 [NC,L]

Now when I hover my mouse over any link (or I click on it) I can see the proper url format (without the "us" folder in it).

It seems that it works now - so is this a good solution?
Thanks.
J.
0
janimeAuthor Commented:
my mistake it's actually this new one:
RewriteRule ^([a-z0-9-/]+).html$ index.php?&url=$1 [NC,L]
0
Tony McCreathTechnical SEO ConsultantCommented:
I don't see how any rewrite rule can effect what you see when you hover over a link?

They must have changed how the links are inserted into the html as well.
0
janimeAuthor Commented:
Well, I double checked the files and it seems that he's done it with adding a function in the php code. The function simply replaces the original urls (with us folder) with links without the folder as per our initial requirements. That's why the links are alright now.
According to all you feedbacks here this looks to be ok. So the links are now generated directly through the php code - no cPanel or htaccess (or other) redirections.

I believe it's fine now. Or do you have any other comments on this?
Thank you.
J.
0
janimeAuthor Commented:
Again any comments so I can close this off?
Is the url modification on PHP level the best solution for this?
Thanks.
J.
0
Tony McCreathTechnical SEO ConsultantCommented:
It sounds like you've just switched of using SEF (Search Engine Friendly) URLs.

Is that what you really want to do?

What is the objective here?

If you have changed all your pages URLs you also want to add a bunch of 301 redirects to help the search engines re-index your website.
0
janimeAuthor Commented:
Tiggerito, the desired modification (getting rid of the "us" folder") was done through the PHP code (on PHP level). Our pages still have the same format- like index.html, contact.html,  etc.. So there has been no SEF swicth - all our links have the html extension..
0
Tony McCreathTechnical SEO ConsultantCommented:
That makes sense
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.