3
votes

I am newbie to Joomla and WAMP environiment. I am using WAMP environment:

  • Win Srv 2003 R2 (Std Ed) with SP2 and all recent updates
  • Apache 2.2.9
  • PHP 5.2.6
  • Joomla 1.5.14

I want to enable mod_rewrite with Joomla SEF URL but it is not working together.

  • If I set 'SEF URLs' and 'Add suffix to URLs' as Yes it works.
    Result: /index.php/page.html

  • If I set 'mod_rewrite' and 'Add suffix to URLs' as Yes it doesn't give any error (not sure if it works the way it suppose to or not).
    Result: /index.php?option=com_content&view=article&id=3&Itemid=5

  • If I set 'SEF URLs' and 'mod_rewrite' as Yes than it give me "404 Not Found" error.
    Result: Not Found | The requested URL /pagename was not found on this server

  • If I set 'SEF URLs' + 'mod_rewrite' + 'Add suffix to URLs' as Yes than it gives me "404 Not Found" error.
    Result: Not Found | The requested URL /pagename.html was not found on this server

I am using the default .htaccess provided by Joomla the code is as follows:

 

##  Can be commented out if causes errors, see notes above.
Options +FollowSymLinks

#
#  mod_rewrite in use

RewriteEngine On


########## Begin - Rewrite rules to block out some common exploits
## If you experience problems on your site block out the operations listed below
## This attempts to block the most common type of exploit `attempts` to Joomla!
#
# Block out any script trying to set a mosConfig value through the URL
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a  tag in URL
RewriteCond %{QUERY_STRING} (\|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
#
########## End - Rewrite rules to block out some common exploits

#  Uncomment following line if your webserver's URL
#  is not directly related to physical file paths.
#  Update Your Joomla! Directory (just / for root)

 RewriteBase /abc  
# /abc is a sub-directory of joomla install in htdocs

########## Begin - Joomla! core SEF Section
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$  [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section



In httpd.conf

  • I have LoadModule rewrite_module modules/mod_rewrite.so active (uncommented #)
  • It has mod_rewrite.so in Apache's modules folder.

I am not sure what else I need to do to make it work. I have checked almost all the forums' posts and blogs. However nothing is helping.

I also have PHP_MAILER issue but that is not as important as this is. I appreciate your help. Please let me know if you need more details to solve this problem.

Kind Regards

DM

1
Where is your Joomla installation located?Gumbo
Installation is located in htdocs/subdirectory I am using vHost so htdocs/subdirectory becomes mydomain.com. Let me know if you have any other questions. (Sorry for bit late reply as this is first time for me on stackoverflow and didnt see where your question was as it was not showing is asnwer or anything else.)DM.
My site was live but due to this issue I had to take it down. At present I have kept everything as localhost. After I resolve the issue I will take it back to live.DM.
Well, your .htaccess sets the RewriteBase to /abc. Try it without that directive.Gumbo
Hi, Thanks for the reply. I have tried following ways - RewriteBase / and - commenting #RewriteBase / However both doesn't work. I always restart my Apache with any changes I make.DM.

1 Answers

8
votes

I found out the answer to my issue: I added the Directory in httpd.conf but AllowOverride was set to None instead of All to allow .htaccess to take effect.

AllowOverride All needs be to there for apache to work with .htaccess. The code would look something like:

<Directory "D:/Apache/htdocs/joomla">
    AllowOverride all
    Options None
    Order allow,deny
    Allow from all
</Directory>

Along with above change one need to have " RewriteBase / "
(set to on, i.e.uncomment RewriteBase /)