URL Rewriting problem

Discuss Search Engine Optimization in relation to Joomla! 3.x. This forum will also have discussions on SEF/SEO Joomla! 3.x extensions.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
Ian90
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Mon Jun 03, 2013 3:38 pm

URL Rewriting problem

Post by Ian90 » Wed Jul 17, 2013 3:12 am

Hi,

Yesterday I decided to change my URL structure about as my site has not gone properly live yet and now I can not get to my rewritten URLs. For example all I get is a 404 not found error when i visit Mysite.com/newyork/Jobsearch but I visit the URLs with the none rewritten URLs like: mysite.com/index.php?option=com_content&view=article&id=156 I get the page I am looking for.

I have tried turning the URLs rewrite and SEFU on and off and I have also removed the # from the .htaccess, I think I have done that correct and nothing seems to change it?

I have been trying for the past 2 days to get it to work but I really am not sure why this isn't working, I have gone over everything at least 5 days! Thank you in advance if any knows whats going on :/

gallagtj
Joomla! Apprentice
Joomla! Apprentice
Posts: 29
Joined: Mon May 06, 2013 9:21 am

Re: URL Rewriting problem

Post by gallagtj » Mon Jul 22, 2013 7:55 pm

I had similar problems. Check you have SEF rewriting turned on and you have renamed you .htaccess.txt file to .htaccess.

I used this .htaccss file which work for me. Don't forgrt to save a copy of your htaccess one if you use this.

Also put your domain in the rewrite rules to fix #Used to remove the virante www/non www test failure


##
# @package Joomla
# @copyright Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.
# @license GNU General Public License version 2 or later; see LICENSE.txt
##

##
# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE!
#
# The line just below this section: 'Options +FollowSymLinks' may cause problems
# with some server configurations. It is required for use of mod_rewrite, but may already
# be set by your server administrator in a way that dissallows changing it in
# your .htaccess file. If using it causes your server to error out, comment it out (add # to
# beginning of line), reload your site in your browser and test your sef url's. If they work,
# it has been set by your server administrator and you do not need it set here.
##

## 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 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.

## Begin - Custom redirects
#
# If you need to redirect some pages, or set a canonical non-www to
# www redirect (or vice versa), place that code here. Ensure those
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.

#Used to remove the virante www/non www test failure
rewritecond %{http_host} ^yourdomain.com [nc]
rewriterule ^(.*)$ http://www.yourdomain.com/$1 [r=301,nc]

## End - Custom redirects

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

RewriteBase /

## Begin - Joomla! core SEF Section.
#
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the request is for something within the component folder,
# or for the site root, or for an extensionless URL, or the
# requested URL ends with one of the listed extensions
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
#
## End - Joomla! core SEF Section.

User avatar
systeman
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 176
Joined: Sat Jun 10, 2006 7:15 am
Location: London
Contact:

Re: URL Rewriting problem

Post by systeman » Tue Aug 06, 2013 9:20 am

Have you fixed it yet and are you using php 5.3 or higher?

A couple of things may have gone wrong here. The sequence of events while setting up your SEF.

Did you rename your htaccess.txt before you enabled it in your Global settings?

Also you mention you remove #. Where did you remove it from?

Important!
Some hosts do not need the line: Options +FollowSymLinks

Try commenting this out, add a #in front like this: #Options +FollowSymLinks

You also have a redirect in place. This causes problems during the process of setting up SEF. Temporarily disable it by commenting out both lines.

After all this, only then enable SEF in Global settings.

Then delete all cache files.

Then go back into your .htaccess file and re-enable the redirect by removing the # on both lines.

Another thing to look out for is this: If you have upgraded your PHP version in cPanel from PHP 5.2+ to PHP 5.3+, make sure you still have PHP5.3+.

Sometimes the PHP version will revert back to PHP 5.2+ if you upgrade from Joomla 2.5 to Joomla 3.1+

If you are using a single php.ini file in root, then make sure it is still in place.

monlike
Joomla! Intern
Joomla! Intern
Posts: 71
Joined: Fri Jun 06, 2014 10:57 am
Location: sweden

Re: URL Rewriting problem

Post by monlike » Sun Jun 21, 2015 9:11 am

how can we solve it in windows host.
because windows server dont support htaccess

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30926
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: URL Rewriting problem

Post by Per Yngve Berg » Sun Jun 21, 2015 9:20 am

IIS Servers uses a web.config file. See this forum: http://forum.joomla.org/viewforum.php?f=717

User avatar
leolam
Joomla! Master
Joomla! Master
Posts: 20652
Joined: Mon Aug 29, 2005 10:17 am
Location: Netherlands/ Germany/ S'pore/Bogor/ North America
Contact:

Re: URL Rewriting problem

Post by leolam » Sun Jun 21, 2015 3:07 pm

Joomla's #1 Professional Services Provider:
#Joomla Professional Support: https://gws-desk.com -
#Joomla Specialized Hosting Solutions: https://gws-host.com -

monlike
Joomla! Intern
Joomla! Intern
Posts: 71
Joined: Fri Jun 06, 2014 10:57 am
Location: sweden

Re: URL Rewriting problem

Post by monlike » Sun Jun 21, 2015 9:18 pm

thanks for your exact help


Locked

Return to “Search Engine Optimization (Joomla! SEO) in Joomla! 3.x”