Link to home
Start Free TrialLog in
Avatar of Yury Merezhkov
Yury MerezhkovFlag for United States of America

asked on

Apache Rewrite Issue

Hi,

We have apache with following directory structure:

/html/a.htm
/html/b.htm
/html/c.jsp
/html/test/d.jsp
/html/test/e.jsp

We need to give user access only to some of these files.

How can we achieve the following with rewrites:

- User enters www.domain.com and gets redirected to /html/a.htm but sees url as www.domain.com/a.htm
- User enters www.domain.com/b.htm and gets redirected to /html/b.htm but sees url as www.domain.com/b.htm
- User enters www.domain.com/d.jsp and gets redirected to /html/test/d.jsp but sees url as www.domain.com/d.jsp
- User can also enter full urls to the files mentioned above and get access to them
- User gets a Gone page if he enters www.domain.com/c.jsp, www.domain.com/e.jsp or corresponding full urls.

Please advise.

Thanks!
Avatar of David Favor
David Favor
Flag of United States of America image

1) www.domain.com has DocumentRoot of /html

This fixes a.htm + b.htm

2) This makes no sense...

- User enters www.domain.com/d.jsp and gets redirected to /html/test/d.jsp but sees url as www.domain.com/d.jsp

Likely you can do this... mkdir test && mv d.jsp test/d.jsp && ln -s test/d.jsp d.jsp

Now www.domain.com/d.jsp returns content from test/d.jsp

3) This doesn't make sense...

- User can also enter full urls to the files mentioned above and get access to them

The best way to reference multiple files by different names is via symlinks, as above.

Keep in mind if you return the same content for different links, the pages involved will receive a duplicate page level content penalty.

If you have to many page level content penalties (Google doesn't say how many), page level content penalty promote to full site duplicate content penalties + you're site will then be out of the index (no SEO results), in practical terms. Your site will still be there, just all SERPs will be demoted, so no one will every see them.

4) This makes no sense either...

- User gets a Gone page if he enters www.domain.com/c.jsp, www.domain.com/e.jsp or corresponding full urls.

By Gone page, I'm guessing you mean a 404 error.

To produce a 404 for c.jsp or e.jsp, remove or rename them.
ASKER CERTIFIED SOLUTION
Avatar of Yury Merezhkov
Yury Merezhkov
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Yury Merezhkov

ASKER

Solution that works.