LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-28-2011, 03:10 AM   #1
sunlinux
Member
 
Registered: Feb 2006
Distribution: RHCL 5
Posts: 233

Rep: Reputation: 30
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
 
Old 11-28-2011, 03:20 AM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Posts: 5,817

Rep: Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002
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
 
Old 11-28-2011, 07:56 AM   #3
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,645

Rep: Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539
@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
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to rewrite/redirect directory to port number in apache? jiecenzhao Linux - Server 4 06-04-2011 05:24 PM
redirect to lowercase directory apache secretlydead Linux - Server 1 05-04-2011 06:06 PM
[SOLVED] Redirect Apache (mod_rewrite) from subdomain to https directory (vhost) accessthecloud Linux - Newbie 2 05-02-2011 07:07 AM
Apache redirect everything but 1 HTML file dfresh4130 Linux - Software 1 04-20-2010 12:16 AM
Apache HTML directory dwpondscum Linux - Networking 5 08-19-2005 08:49 PM


All times are GMT -5. The time now is 02:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration