2

I have been trying to fix a URL rewriting issue in Joomla 2.5 for a little while now. The global configuration settings for "Search Engine Friendly URLs" and "Use URL rewriting" are both set to "Yes", and the .htaccess rewrite section is included below:

## 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 base64_encode data within the URL.
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
# Block out any script that includes a <script> tag in URL.
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%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})
# Return 403 Forbidden header and show the content of the root homepage
RewriteRule .* index.php [F]
#
## End - Rewrite rules to block out some common exploits.

It only seems to be happening on the homepage, where 'index.php' is being appended to the end of the URL.

Also, it all seemed to work fine previously, and as far as I know nothing changed when it began appearing differently (i.e. with index.php). I've followed the suggestions of all similar support threads that I've found and nothing seems to have helped at all. Any help would be greatly appreciated.

2
  • Can you add a link to your site so we can see the problem for ourselves?
    – Mikan
    Commented Mar 15, 2016 at 19:35
  • The site is newwine.co.uk
    – Wychwood
    Commented Mar 16, 2016 at 9:29

1 Answer 1

2

Your page seems to reside on a Microsoft IIS 7.5 server, thus .htaccess does nothing. It also gives a 302 redirect so I am guessing the service provider moved your page?

This page seems to have the instructions for enabling rewrite on IIS 7.

Oddly enough the rewrite itself does seem to work, it just adds the index.php if URL is to root. So somebody set it up for IIS, but maybe not quite correctly? Or maybe IIS version just looks different?

5
  • Hi, thanks for coming back to me on this. Your help is much appreciated. I've spoken to my hosting team about this one in the past, and even though it's an IIS server, they had already configured it to use .htaccess. Here is the response straight from them: "We have actually configured our windows hosting packages to be able to handle .htaccess files, so performing the redirect via a .htaccess file would work fine. Also IIS URL Rewrite Module is enabled."
    – Wychwood
    Commented Mar 16, 2016 at 10:35
  • @Wychwood I actually assumed it was something like that since that is easiest way that would make you think .htaccess is working with IIS. Did you try using one of the joomla.org methods specifically for IIS? Commented Mar 16, 2016 at 12:02
  • I did look at that article. I tried both of the options under the IIS heading. The web.config one didn't work (which I didn't expect it to), and I have no options in the IIS section of the site's Control Panel to be able to set up the URL rewrite rule as per the details given. Might I be missing something with the GUI option?
    – Wychwood
    Commented Mar 16, 2016 at 13:22
  • @Wychwood I think the key here is that 302 redirect, it redirects you to the index.php and since the index.php file obviously exists the .htaccess will not rewrite it. I think you should ask the service provider how exactly they set IIS to load index.php as default. They might have done it with a redirect which would explain your issue. Commented Mar 16, 2016 at 14:40
  • My service provider has finally come back to me (their support service is not the quickest!) The redirect is being done with a 302 redirect at the moment. They say the 302 redirect can be changed to whatever I want it to be, though. Would I need to ask them to change this to something specific, or would I need to change it myself in the .htaccess?
    – Wychwood
    Commented Mar 18, 2016 at 12:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.