Pages: 12Next
Current Page: 1 of 2
mod_rewrite not working
Posted by: shadyyx (---.karneval.cz)
Date: February 16, 2010 09:04PM

Hi guys.

My problem is as follows:

I have mod_rewrite (or rewrite_module) enabled. (did through wamp tray icon > Apache > Modules > left click on module >> Apache restarted and also checked in http.conf file -> module was uncommented!).

But still I cannot get mod_rewrite to work!!!

E.g. my local Drupal installation do not allow me to turn it on in settings in administration and also if I use .htaccess file with rewrite rules/conditions, server is always redirecting me to 404.

My WAMPserver version is 2.0 (PHP vesion 5.2.28, Apache version 2.2.11).


Many thanks for any help!!!

Options: ReplyQuote
Re: mod_rewrite not working
Posted by: yfastud (Moderator)
Date: February 16, 2010 11:45PM


Options: ReplyQuote
Re: mod_rewrite not working
Posted by: shadyyx (---.karneval.cz)
Date: February 19, 2010 12:40AM

Thanks for reply.

The problem is not just with Drupal, I cannot use mod_rewrite anywhere else... It always turns into 404 or dies in loop redirectioning...

It doesn't matter if I use Drupal, Joomla, own app or whatever working example (as creator proclaim) -> it does not work...

May all this be caused by my listen port set to 81 (instead of default 80 - reason is Skype that is also listening on port 80) ???

Anyway, yfastud, article you'd recommended was about setting up the Drupal - basic installation... That's no help - I have installed and configured and am using Drupal but "nice URL's"...

Options: ReplyQuote
Re: mod_rewrite not working
Posted by: c2dan (---.15-1.cable.virginmedia.com)
Date: February 19, 2010 06:54PM

Skype can be configured to use a port other than port 80. Have a look in the settings

Options: ReplyQuote
Re: mod_rewrite not working
Posted by: shadyyx (---.karneval.cz)
Date: February 19, 2010 10:23PM

OK, I'll give it a try - but it doesn't answer my question :-)

Could be mod_rewrite misfunction caused by listen port set to "not default" settings???

Anyway, I'll try to change settings of skype and to change the listen port back to 80 and will see, if problem persists...

Thanks for now...

Options: ReplyQuote
Re: mod_rewrite not working
Posted by: c2dan (---.15-1.cable.virginmedia.com)
Date: February 20, 2010 11:54AM

It could be how you're setting up your rewrite rules in your .htaccess.

To test disable skype and configure Apache to listen on port 80.

Options: ReplyQuote
Re: mod_rewrite not working
Posted by: shadyyx (---.karneval.cz)
Date: February 20, 2010 12:10PM

OK, I did set te listen port to 80 and tested mod_rewrite.

NOT WORKING!


Here's my .htaccaess:

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/([0-9a-zA-Z\.\-]*)\.(p|a)([0-9]*)\.html [NC]
RewriteRule ([a-zA-Z.-]*)\.p([0-9]*)\.html index.php?p=$2 [L,QSA]
RewriteRule ([a-zA-Z.-]*)\.a([0-9]*)\.html index.php?a=$2 [L,QSA]


And here's like the URL should look like:

[localhost]

Options: ReplyQuote
Re: mod_rewrite not working
Posted by: c2dan (---.15-1.cable.virginmedia.com)
Date: February 20, 2010 05:58PM

Is your .htaccess file in C:\wamp\www

If it is, edit it and add an invalid command to the file, eg
hello

if Apache is reading the .htaccess properly it should display a 500 Internal Server Error when going to [localhost]

If you're getting an error you can now delete the invalid command added earlier. For some reason your rewrite rules are not working.

If you're not getting the 500 Internal Server Error message then Apache is not reading your .htaccess file. Left click the WAMP tray icon and choose Apache > httpd.conf

Find the following lines
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
After those lines you should see a line like so
    AllowOverride
After AllowOverride make sure it has the word 'all' (without the quotes) after it. If you make any changes to the httpd.conf make sure you restart Apache service

Options: ReplyQuote
Re: mod_rewrite not working
Posted by: shadyyx (---.karneval.cz)
Date: February 20, 2010 06:32PM

Yep, when typed 'hello' into the .htaccess, it displayed a 500 page.

I've checked http.conf - there is AllowOverride all.
I've checked alias .conf file for the URL in post above and configs are:

    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order allow,deny
    Allow from all

Options: ReplyQuote
Re: mod_rewrite not working
Posted by: yfastud (Moderator)
Date: February 22, 2010 11:11PM

shadyyx, your wamp is working fine but your rewrite rules, so you should discuss it in some other coding forums instead

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: mod_rewrite not working
Posted by: shadyyx (---.karneval.cz)
Date: February 22, 2010 11:17PM

Thanks yfastud.

I'd expected that kind of answer (from somebody).

Problem is - if nothing is working (nice URLs in Joomla, in Drupal, in Wordpress => where it should be working FINE from the very start, then other rewrite rules/conds in other applications (like my own)) - you have to look for problem at the base.

So how it is possible, that for everybody (except me) rewrite rules are working (tried also to send my .htaccess and application to a friend and it worked for him) but for me there is no way to make it work???

Options: ReplyQuote
Re: mod_rewrite not working
Posted by: yfastud (Moderator)
Date: February 22, 2010 11:33PM

Quote

you have to look for problem at the base
shadyyx, we're here to support wampserver users, not coding problem so put it this way: create a test folder w/ some test files and a test htaccess w/ only a very simple rewrite rule; if it still does not work, zip and email that test folder to me and I will test it out for you; if that simple rewrite rule does work, then you know that you have problem w/ your current rules which you should discuss in some coding forums for more help winking smiley

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: mod_rewrite not working
Posted by: shadyyx (---.karneval.cz)
Date: February 23, 2010 12:07AM

OK, I'll try it.

Your email is hidden, so can You, please, let me know at my email (mine should be visible)?

If it won't work, I'll email you, otherwise no bothering, don't worry ;-)

Options: ReplyQuote
Re: mod_rewrite not working
Posted by: yfastud (Moderator)
Date: February 23, 2010 02:04AM

I've just tested this sample works; create folder testrewrite in folder www w/ 3 files index.html, index2.html, and .htaccess as shown below, then type in browser 'http://localhost/testrewrite' and you should see the line 'Rewrite working'
<!-- index.html file-->
<html>
   <body>
      <p>
         Rewrite NOT working
      </p>
   </body>
</html>

<!-- index2.html file -->
<html>
   <body>
      <p>
         Rewrite working
      </p>
   </body>
</html>

# htaccess file
RewriteEngine on
RewriteRule ^index.html$ index2.html

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: mod_rewrite not working
Posted by: shadyyx (---.karneval.cz)
Date: February 23, 2010 09:49AM

Hello again.

Many thanks for your sample test. I've tried it and the result is as follows:

I've put it in c:/wamp/www -> WORKED fine.

But mostly I create apps in c:/www/ and create an alias for it, so next I tried to put /testrewrite/ in c:/www/ and created an alias. Result: 404 w/ "The requested URL /www/testrewrite/index2.html was not found on this server" message.

Here is my alias code:
Alias /testrewrite/ "c:/www/testrewrite/" 

<Directory "c:/www/testrewrite/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order allow,deny
    Allow from all
</Directory>

So apparently there is no problem with mod_rewrite, but with aliases using mod_rewrite.

Options: ReplyQuote
Re: mod_rewrite not working
Posted by: c2dan (---.15-1.cable.virginmedia.com)
Date: February 23, 2010 06:27PM

Why are you creating an alias? An alias should only be created for folders outside of the document root (C:/wamp/www)

Options: ReplyQuote
Re: mod_rewrite not working
Posted by: shadyyx (---.karneval.cz)
Date: February 23, 2010 07:14PM

Because I create aliases for folders outside c:/wamp/www - I create them for c:/www/.

Better reading - less misanderstandig...

I've written: "mostly I create apps in c:/www/ and create an alias for it" and
Alias /testrewrite/ "c:/www/testrewrite/"
=> that all means, I have to create an alias...

Options: ReplyQuote
Re: mod_rewrite not working
Posted by: c2dan (---.15-1.cable.virginmedia.com)
Date: February 23, 2010 07:47PM

Try setting the rewriteBase to /testrewrite/

Example .htaccess code
RewriteEngine On

RewriteBase /testrewrite/
RewriteRule ^index.html$ index2.html

Its your aliases that are causing mod rewrite to not function correctly. I think you may be better of setting up virtual hosts instead. However I think setting the rewriteBase should sort this issue.

Options: ReplyQuote
Re: mod_rewrite not working
Posted by: shadyyx (---.karneval.cz)
Date: February 23, 2010 08:34PM

Thanks, using RewriteBase helped for that case.

That means that for every alias I am using I have to add this RewriteBase rule???


Lets say, I have an alias created like
Alias /drupal/ "c:/www/CMS/drupal/"
and then I have to add a rule to .htaccess:
RewriteBase /drupal/
or whatever???


Many thanks for help!!!

Options: ReplyQuote
Re: mod_rewrite not working
Posted by: c2dan (---.15-1.cable.virginmedia.com)
Date: February 23, 2010 09:02PM

Yea you'll have to do that for each alias.

Options: ReplyQuote
Pages: 12Next
Current Page: 1 of 2


Sorry, you can't reply to this topic. It has been closed.