Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Apachie mod_rewrite - How to setup

Posted on 2011-03-25
8
Medium Priority
?
295 Views
Last Modified: 2012-05-11
Hello all. I have been to the Apachie site and looked at their docs but remain confused.

I have a testing Apachie server at home working with php with no problems. I am playing around now with Wordpress and want to get the permalinks working but have problems. On my main hosted site everything works fine.

Can someone please walk me through the process of setting mod_rewrite and then testing that it works. What I have done so far is set #LoadModule rewrite_module modules/mod_rewrite.so  to LoadModule rewrite_module modules/mod_rewrite.so in my httpd.conf but this does not seem to work.

Thanks
0
Comment
Question by:jezella
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 51

Expert Comment

by:Steve Bink
ID: 35221014
What version of Apache, and what OS?

You can verify mod_rewrite is being loaded by using the -M switch on your control app.  Usually, this is "httpd -M" or "apache2ctl -M", depending on your installation flavor.  If rewrite is loaded, you will see rewrite_module in the output somewhere:

[root@myserver:/home]
#> apache2ctl -M | grep "rewrite"
Syntax OK
 rewrite_module (shared)

Open in new window


Once you are sure rewrite is being loaded, you will need to establish your RewriteRule directives.  These can be very simple, or amazingly complex, depending on your needs.  You can try using the RewriteLog directive to assist with troubleshooting.  If you would like us to assist in that effort, post the rules you have with a detailed explanation of what you want the rule to do.
0
 

Author Comment

by:jezella
ID: 35221303
I'm sorry I ought to have said. Apachie is  5.2.3 and the operating system is windows 7. I'm not sure what the code above means. Do I create a basic page with the code above in place and then run it?. I have the following in my phpinfo.php but not sure if this is anything to do with it.
Capture.JPG
0
 
LVL 51

Expert Comment

by:Steve Bink
ID: 35222261
Apache is not v5.2.3.  The most recent version is 2.2.  It sounds like you are reporting your PHP version.  Post the entirety of your phpinfo() output.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:jezella
ID: 35222832
Yes this is true what you say. I've added a pdf of the phpinfo output.
phpinfo--.pdf
0
 
LVL 51

Expert Comment

by:Steve Bink
ID: 35223189
On page 3 of that PDF, under the section titled "apache2handler", you will see mod_rewrite listed under "Loaded Modules".  So rewrite should be on target.  The next step is testing it.

There are two ways to set up rewriting.  You can either edit the Apache server's conf file, or, assuming you have allowed for them, edit the .htaccess file for the site you are attempting to manage.  If you have rules already set up, please post them.  Also, explain what sort of redirection you want accomplish, with as much detail as possible.

0
 

Author Comment

by:jezella
ID: 35223292
Thank you for your help on this and I'm sorry for the delayed response. I seem to be having an internet connection problem today.

Code follows for the .htaccess file.


# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Open in new window

0
 
LVL 5

Accepted Solution

by:
onemadeye earned 2000 total points
ID: 35228642
As you have set this on httpd.conf

#LoadModule rewrite_module modules/mod_rewrite.so
to
LoadModule rewrite_module modules/mod_rewrite.so

Next, in that same httpd.conf file you also need to find:

AllowOverride None
.. and replace it with :
AllowOverride All

It appears 2 or 3 times I guess...
Then the mod rewrite url will be ready for your scripts ..

Regards...
0
 

Author Comment

by:jezella
ID: 35230470
Onemadeve.

YOUR ARE FANTASTIC. I did the AllowOverride None to AllowOverride All in the past and it never worked. The simple fact that you mentioned that this needed to be changed in multiple places did the trick.

Many thanks.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question