LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   add html to a directory in apache redirect (https://www.linuxquestions.org/questions/linux-newbie-8/add-html-to-a-directory-in-apache-redirect-915952/)

sunlinux 11-28-2011 03:10 AM

add html to a directory in apache redirect
 
I want to get below in apache redirect:

suppose a user type

www.abe.com/a it should go to www.abe.com/a.html
if he types
www.abe.com/a/tik it should go to www.abe.com/a/tik.html

pls suggest

corp769 11-28-2011 03:20 AM

Hello,

Read here - http://httpd.apache.org/docs/2.0/mod/mod_alias.html
This contains the documentation needed to do what you intend to do.

Cheers,

Josh

bathory 11-28-2011 07:56 AM

@OP

It could be done using mod_rewrite:
Code:

RewriteEngine On
RewriteRule ^a/$ /a.html
RewriteCond %{REQUEST_URI} !^/a/(.+).html$
RewriteRule ^a/(.*) /a/$1.html



All times are GMT -5. The time now is 08:17 PM.