Hi,
I'm having trouble getting my RewriteCond and RewriteRule to work properly. All i need to do is rewrite a rule for just one URL. I want "index.php/locations/maryland/self-storage-baltimore-md" to be "maryland/self-storage-baltimore-md" .The bolded area below is what I added. I've checked many sources and it seems to be correct. Yet, when I save the file and go check the URL, it's still showing the former URL. Not sure what I'm doing wrong 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!
#
RewriteBase /
RewriteCond %{REQUEST_URI} ^index.php/locations/maryland/self-storage-baltimore-md [NC]
RewriteRule ^maryland/self-storage-baltimore-md$ index.php/locations/maryland/self-storage-baltimore-md[L]
# 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.
htaccess Rewrite not working for Joomla site
Moderator: General Moderators
Re: htaccess Rewrite not working for Joomla site
Try without the RewriteCond.
Re: htaccess Rewrite not working for Joomla site
Thanks for the reply. That didn't work. I actually tried initially without the conditionrequinix wrote:Try without the RewriteCond.
Re: htaccess Rewrite not working for Joomla site
...You're expecting the URL to change? You need a [R] flag to force mod_rewrite to actually redirect you, otherwise it'll just do the redirection behind the scenes.
Otherwise if you're going to exactly "/maryland/self-storage-baltimore-md" then I don't know why you're not seeing the "index.php/locations/maryland/self-storage-baltimore-md" page.
Otherwise if you're going to exactly "/maryland/self-storage-baltimore-md" then I don't know why you're not seeing the "index.php/locations/maryland/self-storage-baltimore-md" page.
Re: htaccess Rewrite not working for Joomla site
I was able to removed the index.php/ portion out of the url but not locations/. When I try to do so, I get a 404 error page
Here's my updated rule.
RewriteRule ^index.php/locations/maryland/self-storage-baltimore-md locations/maryland/self-storage-baltimore-md [R]
Here's my updated rule.
RewriteRule ^index.php/locations/maryland/self-storage-baltimore-md locations/maryland/self-storage-baltimore-md [R]
Re: htaccess Rewrite not working for Joomla site
So you're going to "index.php/locations/maryland/self-storage-baltimore-md" and expecting to be redirected to "locations/maryland/self-storage-baltimore-md"?
Re: htaccess Rewrite not working for Joomla site
Right. And so far it is doing that now, except I can't seem to be redirected to maryland/self-storage-baltimore-md which takes me to a 404 error pagerequinix wrote:So you're going to "index.php/locations/maryland/self-storage-baltimore-md" and expecting to be redirected to "locations/maryland/self-storage-baltimore-md"?
Re: htaccess Rewrite not working for Joomla site
I have the same problem in RewriteCond. I tried removing it. But does not work.
Ada