When I request the file https://www.hello.com.au/myfile.txt
I got an error "Not Found. The requested URL https://www.hello.com.au/myfile.txt was not found on this server."
Here's my .htaccess rule, which is working fine on my dev site, but not working on Production.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} !^(?:www\.)?hello\.com\.au$ [NC]
RewriteRule ^myfile\.txt$ - [NC,F]
</IfModule>
I found, the file myfile.txt doesn't exists in Production. Thanks everyone for your help.
Related
i have following code but redirection is not working plz help
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^products/([A-Za-z0-9-]+)/?$ product.php?name=$1 [L,NC]
</IfModule>
it is not reditrecting to product.php
I modifyed the Link now and think this should work.
I tested it on my local server and it works.
RewriteRule ^([/products]+)/(.*)$ product.php?name=$1&%{QUERY_STRING} [L]
On my installation, i work on a sub dir so it can be that the param should be $2 instead of $1
It have also an impact if you use
href"hello.com....."
or
href="http://hello.com....."
I got a .htaccess issue, and I don't know why, because it should be working.
What I'm trying to do with this code is redirect https://www.sub.domain.com to https://sub.domain.com
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.sub\.domain\.com$ [NC]
RewriteRule ^(.*)$ https://sub.domain.com/$1 [L,R=301]
When I test this code at http://htaccess.madewithlove.be/, it works succesfully.
(Request url: https://www.sub.domain.com, output url: https://sub.domain.com)
Also as mentioned in this question, I checked my DNS records , and there is an www.sub which points to the some domain as sub (both A's).
At this point I'm stuck, does anyone know what I did wrong?
Any help would be appreciated.
Create a file called .htaccess in the doc root (web / httpdocs / www folder) of https://www.sub.domain.com and put in the code below
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) https://sub.domain.com/$1 [R=301,L]
I'm changing my URL structure in my Wordpress website. So I'm using the .htaccess file to redirect the URLS. When I add the following code in .htaccess the url www.mydomain.com/test/?lang=en redirects correctly to www.test.com
RewriteEngine On
RewriteCond %{QUERY_STRING} ^lang=en$ [NC]
RewriteRule ^test/$ http://www.test.com/? [R=301,NE,NC,L]
My website is also in Russian.
My goal is to redirect www.mydomain.com/шарон/?lang=RU to www.test.com.
I tried to add the following code to .htaccess:
RewriteCond %{QUERY_STRING} ^lang=RU$ [NC]
RewriteRule ^%D1%88%D0%B0%D1%80%D0%BE%D0%BD/$ /www.test.com? [R=301,NE,NC,L]
But the redirect doesn't work. I got a "can't display the page" error, I think a 404 error.
I also tried to add the Russian text into the .htaccess file. And saved the .htaccess to UTF-8 file format.
RewriteCond %{QUERY_STRING} ^lang=RU$ [NC]
RewriteRule ^шарон/$ /www.test.com? [R=301,NE,NC,L]
Then I get the message below, my website isn't reachable anymore.
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator to inform of the time the error occurred and of anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Does anyone have an idea how to redirect my Russian urls?
I'm not sure if URL can be specified that way when doing rewrites. Try changing it to
RewriteCond %{QUERY_STRING} ^lang=RU$ [NC]
RewriteRule ^\xd1\x88\xd0\xb0\xd1\x80\xd0\xbe\xd0\xbd/$ /www.test.com? [R=301,NE,NC,L]
Where
\xd1\x88\xd0\xb0\xd1\x80\xd0\xbe\xd0\xbd
equals to
%D1%88%D0%B0%D1%80%D0%BE%D0%BD
and therefore also to
шарон
Hope it helps. Comment on this if you have further problems. ;)
I know there are a few of (probably) the same questions out there, but I just can't find any working solution.
I've placed the .htaccess file next to my index.php on the server.
And even if the .htaccess is empty the site returns error 403 (forbidden access).
What I wanted to do is remove the .php extension.
http://foo.net/web_new/index_1024.php
And even if I put the following into the .htaccess, the website still returns error 403.
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
</IfModule>
I've found on the web, to enable the mod_rewrite, I should enable it in httpd.conf. But I search the whole server (ftp), but there is no clue.
where phpinfo() finds conf.d file
/etc/php5/conf.d
where is my root
/srv/www/web6/
Any idea, what could i do?
Make sure that .htaccess has 644 permissions
I think you can remove that ifModule... I find it "messy" there...
Your code looks well...
I'm trying to rewrite my bulky, ugly url to a neat one which is converting "art.php?id=$1" in to "art/1", but I encounter a "500 Internal Server Error" What shall I do? Can you help me pleeeease?
This is the .htaccess code I used:
RewriteEngine On
RewriteRule ^art/([A-Za-z0-9-]+)/?$ art.php?id=$1 [NC,L]
This is the Error I encountered:
Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request. Please contact the server
administrator, admin#localhost and inform them of the time the error
occurred, and anything you might have done that may have caused the
error. More information about this error may be available in the
server error log.
Thanks!
Supposed everything is in the gallery folder, which itself is located in the www root directory. Then put this .htaccess file into the gallery folder as well
RewriteEngine on
RewriteBase /gallery/
# prevent endless loop
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule .* - [L]
# serve real content
RewriteRule ^art/([A-Za-z0-9-]+)/?$ art.php?id=$1 [NC,L]
# make pretty URL
RewriteCond %{QUERY_STRING} id=(.+)
RewriteRule ^art.php$ art/%1? [R,NC,L]
Depending on the server you're on, you might want to set the base for rewriting
RewriteEngine On
RewriteBase /art/
RewriteRule ^([A-Za-z0-9-]+)/?$ art.php?id=$1 [NC,L]
that should work just fine