LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 04-01-2009, 09:02 AM   #1
slims7
LQ Newbie
 
Registered: Sep 2008
Posts: 9

Rep: Reputation: 0
How to use mod_rewrite to create clean URLs ?


MY Apache is on Centos 5.2

It is installed here:
/etc/httpd.

Modules are in:
/etc/httpd/modules

I searched a lot but I did not found how to install mod_rewrite.

I want to do url cleaning.

Can you help me please?

Slims
 
Old 04-01-2009, 11:53 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
It should be already installed. Run
Code:
httpd -M
to verify that is installed. Then you can use
Code:
LoadModule rewrite_module modules/mod_rewite.so
to load the module
 
Old 04-02-2009, 01:03 PM   #3
slims7
LQ Newbie
 
Registered: Sep 2008
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by bathory View Post
It should be already installed. Run
Code:
httpd -M
to verify that is installed. Then you can use
Code:
LoadModule rewrite_module modules/mod_rewite.so
to load the module

Hi bathory,

When i run command 'httpd -M', the output is

root@tech [~]# httpd -M
Loaded Modules:
core_module (static)
authn_file_module (static)
authn_default_module (static)
authz_host_module (static)
authz_groupfile_module (static)
authz_user_module (static)
authz_default_module (static)
auth_basic_module (static)
include_module (static)
filter_module (static)
log_config_module (static)
logio_module (static)
env_module (static)
expires_module (static)
headers_module (static)
setenvif_module (static)
proxy_module (static)
proxy_connect_module (static)
proxy_ftp_module (static)
proxy_http_module (static)
proxy_ajp_module (static)
proxy_balancer_module (static)
ssl_module (static)
mpm_prefork_module (static)
http_module (static)
mime_module (static)
status_module (static)
autoindex_module (static)
asis_module (static)
info_module (static)
suexec_module (static)
cgi_module (static)
negotiation_module (static)
dir_module (static)
actions_module (static)
userdir_module (static)
alias_module (static)
rewrite_module (static)
so_module (static)
auth_passthrough_module (shared)
bwlimited_module (shared)
frontpage_module (shared)
php5_module (shared)
Syntax OK

and also the line 'LoadModule rewrite_module modules/mod_rewite.so' is not present in my '/etc/httpd/conf/httpd.conf' file.

Now how to enable or shall we need to install OS once again ? or where I can finf exact required file in my centos 5.2 (final).

I would really appreciate if somebody who can help me.

THank you
regards

Slims
 
Old 04-02-2009, 01:17 PM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
You don't need the "LoadModule rewrite_module ...", since it's statically compiled into apache. All you need is
Code:
RewriteEngine on
before writing the rewrite rules you want in httpd.conf.
 
Old 04-02-2009, 01:39 PM   #5
slims7
LQ Newbie
 
Registered: Sep 2008
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by bathory View Post
You don't need the "LoadModule rewrite_module ...", since it's statically compiled into apache. All you need is
Code:
RewriteEngine on
before writing the rewrite rules you want in httpd.conf.
Hey Bathory

I am really new to linux, kindly explain me little clear, as you mentioned above no need of "LoadModule rewrite_module ..." but we need "RewriteEngine on" let me know where the rewrite rule have to implement?

Regards

slims
 
Old 04-02-2009, 01:56 PM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
What I mean is that since the mod_rewrite is static (i.e. built-in), you don't need the "LoadModule rewrite_module modules/mod_rewite.so" directive in httpd.conf, so there is no need to concern because it's not present.
Now if you want to use mod_rewrite to rewrite URLs you need to enable the module. This is done with the "RewriteEngine on" directive.
After that you can start using the available rewrite rules to do want you want. I suggest you to start reading about mod_rewrite before trying to apply your rewrite rules. A good starting point is the Apache mod_rewrite documentation.

Regards

Last edited by bathory; 04-02-2009 at 01:57 PM.
 
  


Reply



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
mod_rewrite basarab1310 Linux - Newbie 1 11-06-2008 07:57 AM
clean URLs with tomcat - mod_rewrite, mod_proxy, or is there a better solution? laggerific Linux - Software 6 09-18-2008 07:17 PM
Create Desktop Links to Web URLs in DFM Mr. Swillis Linux - Desktop 4 06-10-2008 11:43 PM
how to check urls and stop internet urls in network gface Linux - Networking 5 03-24-2005 09:48 PM
mod_rewrite not rewriting urls chr15t0 Linux - General 1 11-09-2003 04:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:06 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
Open Source Consulting | Domain Registration