I am trying to modify htaccess file.
I already have 3 language structures on my site (en / tr / ar).
htaccess is works fine for TR/EN , but I see the following error in arabic pages.
Image is below that you can see
https://image.ibb.co/cqHNTb/Untitled_1_copy.png
Related
I changed my website from .asp pages to Joomla which uses .php. The page structure has not been maintained. Now, I would like to have all traffic coming in from the indexed .asp pages (by the search engines) redirected to the home page of my site.
I have used the following Rewrite rule
RewriteRule \.asp$ ^/index.php [R=301,L]
but the rule redirects to
https://example.com/home/example/public_html/index.php?key=1234
How can I simply remove the /home/example/public_html/ and also the ?key=1234 parameter while performing the redirect. Or simply saying, how can I just have the redirect go to the home page of my new site.
Thanks.
First see this picture from Apache below :
So , a substitution could not contains Regular Expression as you did here ^/index.php this ^ should be removed first then see what you want to do .
https://httpd.apache.org/docs/2.4/rewrite/intro.html
Replace your code by this :
RewriteRule \.asp$ http://example.com? [R=301,L]
I put ? after example.com to prevent query string like key=1234 to be appended in new target .
Note: clear browser cache then test it .
Hi I want to remove the index.php in my url. I tried alot of methods but none of them work. All of them reponse 500 error or could not find folder. any one can help me please. I just use normal joomla page dont have any thing special but removing index.php seem impossible to me
This is link to my website http://www.website.com/index.php/vn/
I am using joomla 2.5
Hi i fixed it. on some sever we have to do a little modified to the htaccess not just remove .txt and add . in front of it.
In my case, I need to add . in to the line "RewriteBase /" => "RewriteBase /."
What you are looking for is an option to turn on search engine friendly URLs. To completely get rid of "index.php" you need to be running Joomla on Apache server.
Rename "htaccess.txt" file in your root Joomla directory to ".htaccess".
Site > Global Configuration > Site > SEO Settings and set these settings:
Search Engine Friendly URLs - Yes
Use URL rewriting - Yes
Adds Suffix to URL - No
Unicode Aliases - No
on some sever we have to do a little modified to the htaccess not just remove .txt and add . in front of it.
In my case, I need to add . in to the line "RewriteBase /" => "RewriteBase /."
Google Webmaster tools gives me a hint that I have 2 pages with the exact same content.
For example:
/airports/romania/115.php
/airports/romania/115.phphey1
In the htacces file i have this:
RewriteRule airports/(.*)/([0-9]{1,}).php airports_list.php?airport=$2&country_air=$1
I've checked and double checked and triple checked all my code in airports_list.php and every other file on the server. I can't find "hey1" anywhere.
In order to solve my problem, I think I have to redirect a link like www.mydomain.com/airports/romania/115.phphey1 to a 404 page.
How do I do that ?
The following is also working inside my .htaccess file :
ErrorDocument 404 http://www.mydomain.com/404.php
If you put a dollar sign at the end of the regex, it stops matching and so garbage at the end of '.php' and goes to the 404.
RewriteRule airports/(.*)/([0-9]{1,}).php$ airports_list.php?airport=$2&country_air=$1
For some reason the urls in one section of our site were changed from php to html some time ago.
I recently setup a Google Webmaster account and noticed the 'old' php pages (20,000 of them!) are appearing as Crawl Errors (403 Forbidden error).
Are these the 'old' urls that Google crawled still showing in the index? If so what can I do? Is the best thing to setup a 301 redirect for all these urls, however what the best way of doing this when all thats changed in the url is the file extension (the php and html files are in the same directory) - is it possible to setup a 301 to redirect one file extension ie php to html within the same directory?
To fix this you definitely want to setup 301 redirects from the old URLs to the new URLs. If you use Apache you can do this by placing a .htaccess file in your root web directory with this snippet in it:
RewriteEngine on
RewriteBase /
RewriteRule ^(.*).html$ $1.php [R=301,L]
I have a link from anther website that I do not have control of http://example.com/one two three.exe
The correct URL is http://example.com/one_two_three.exe
Note the underscores instead of spaces.
I searched the internet and found this code snippet for .htaccess
# Redirect old file path to new file path
Redirect /one%20two%20three.exe http://example.com/one_two_three.exe
I added this snippet to my preexisting root .htaccess at the top of the file.
But it does not seem to work. My browser does not redirect and I get a 404 error page.
I believe that it has something to do with the spaces in the original URL but I don't know how to handle spaces in the URL.
Suggestions?
You could try a couple of things (both untested)
Redirect "/one two three.exe" http://example.com/one_two_three.exe
or use RewriteRule instead of Redirect:
RewriteRule /one\ two\ three.exe http://example.com/one_two_three.exe