My .htaccess works perfect on live server but shows 500 error when setup on local machine. If I remove Chinese, Japanese, Turkish, Russian rules from it it works perfect but it necessary to have those charters in it.
Example:
RewriteRule ^会員専用サイト\/今すぐ登録.php /JP/members/join_now.php?rw=$0&lang=JP&%{QUERY_STRING} [L]
RewriteRule ^Члены\/Регистрация.php /RU/members/join_now.php?rw=$0&lang=RU&%{QUERY_STRING} [L]
RewriteRule ^üye\/Kayıt-ol.php /TR/members/join_now.php?rw=$0&lang=TR&%{QUERY_STRING} [L]
RewriteRule ^멤버구역\/가입.php /KR/members/join_now.php?rw=$0&lang=KR&%{QUERY_STRING} [L]
also used chartset to UTF-8 in htaccess but no success
Local machine using WAMP
OS: Windows XP, Windows 7
I've tested it successfully on a Debian 6.0 machine + windows7 wamp. So it should be working.
Of course you need to make sure your files are well encoded and apache can handle them.
For wamp: open the httpd.conf file from the notification icon. Notepad should pop-up.
Save the file as : select UTF-8 and filter *.*
Please make sure that the file is saved as httpd.conf and not httpd.conf.txt
Add the rules.
Restart the services. Should work.
FYI
Tested on Debian 6.0:
RewriteRule ^会員専$ /stack/redirect.php [L,R]
Is working fine for me. Here is the log:
strip per-dir prefix: /var/www/会員専 -> 会員専
applying pattern '^会員専$' to uri '会員専'
rewrite '会員専' -> '/stack/redirect.php'
explicitly forcing redirect with http://mysite.org/stack/redirect.php
escaping http://mysite.org/stack/redirect.php for redirect
redirect to http://mysite.org/stack/redirect.php [REDIRECT/302]
strip per-dir prefix: /var/www/stack/redirect.php -> stack/redirect.php
applying pattern '^会員専$' to uri 'stack/redirect.php'
pass through /var/www/stack/redirect.php
Related
When working on a project, I would like to use the online images, so I don't have to download e.g. all images (as described here).
To achieve this, I wrote a view lines in my .htaccess-file:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{SERVER_PORT} 8890
RewriteRule ^wp/media/.+ https://www.example.com:443%{REQUEST_URI}
</IfModule>
According to htaccess.madewithlove.be this should convert an image url from:
https://example.localhost:8890/wp/media/27442.jpg
to:
https://www.example.com/wp/media/27442.jpg
Context:
MacBook Pro
OS X Catalina 10.15.2
MAMP Pro 5.5.1
WordPress 5.3.2
example.localhost:8890 (SSL) up and running
local website is working fine
What I already tried/verified/adjusted:
How to get htaccess to work on MAMP
mamp pro htaccess rewriteRule not working
https://wordpress.stackexchange.com/questions/346778/rewrite-rule-to-load-images-from-production-does-nothing?rq=1
The .htaccess is being executed. When entering garbage, I got a error 500
Changed httpd.conf accordingly
Am I missing something? What else could prevent this from working?
The problem was that I had another .htaccess-file inside the wp-folder, because I moved the WordPress installation into its own directory (see here). When moving the rules into this inner .htaccess-file, it started working immediately.
I've got mod_mono and mono installed on my webserver and I'm trying to get this simple modrewrite working, however it seems to be ignored by mod mono.
RewriteEngine on
RewriteRule ^Projects/page1.cshtml$ /project2 [PT]
I have that in my .htaccess in the document root. If I use any other extension besides .cshtml, it works as intended. Any ideas?
Is there some problem with URLs which have word error in them? Because if I enter route like http://eshop.local/controller/action, where controller can be anything at all, there's no problem, but if controller is error, it returns:
Error 404 Page not found
My htaccess:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]
http://eshop.local/error works fine but if is followed by some action whatever word, number, or anything returns 404 error.
EDIT:
Just now i have copied it to my webhosting, everything with error urls is working fine, so problem is on XAMPP side.
Hold Your Breath
Open xampp control panel
Stop Apache
Click the Config button on the Apache row, and select httpd.conf
In that file, search for <Directory "C:/xampp/htdocs">
A bit lower, you may see a line like this: # AllowOverride All. Remove the #, which is a comment
Save the file
Restart Apache, say a prayer, cross your fingers and hold your breath
Response from Altrea, Moderator from XAMPP forum:
All URLs that are used in an Alias, Location or Proxy definition.
There are a bunch of them in XAMPP Apache (depending on which config files are activated or not some of them are maybe not used):
/cgi-bin/
/error/
/examples
/icons/
/licenses
/manual
/my-gateway/
/phpmyadmin
/php-cgi/
/security
/server-info
/server-status
/uploads
/webalizer
/webdav
In your case /error/ is already useds
Is it possible to reuse for example that /error/ or it' s better to change it in my code for example to /err/ ?
This Alias is used for the default Apache
error Pages (everywhere ErrorDocuemnt is used this Alias is used).
So it is possible to change it in XAMPP, but you have to
search and replace multiple files.
I'm just going to explain my problem here :
http://mysite.com/movie/20000
should be rewritten to
http://mysite.com/movie.php?id=20000
my htaccess file :
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^movie/([0-9]+)$ movie.php?id=$1
On my localhost WAMP installation this works fine, but when I put it online on my linux host it doesn't completely work. It does go to the movie.php page, but it seems it gives no GET parameter id.
Edit :
if I use
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^movie([0-9]+)$ movie.php?id=$1
then
http://mysite.com/movie20000
Goes to the correct page, but I would like /movie/20000 and not just /movie20000
It also seems that my host automatically rewrites a visit to mysite.com/movie to mysite.com/movie.php
After searching for a long time, and pulling some of my lovely hair out I found the solution.
I just added
Options -MultiViews
to my htaccess file and that fixed it.
Why? Because .php was being added to urls without an extension, which I really did not need.
This should work.
RewriteRule ^movie/([0-9]+)$ http://mysite.com/movie.php?id=$1 [NC,L]
Don't forget the [NC, L] it means Case insensitive, last rule... If you don't, it will continue to process through your htaccess rules, maybe triggering other ones.
Still, the stuff below is good advice.... :)
Check to see if the Rewrite module is loading with apache. Look for this line in the httpd.conf file:
LoadModule rewrite_module modules/mod_rewrite.so
Check to see if your apache config allows for .htaccess files for your system or in the virtual host definition.
Also, test with a simpler rewrite catch all and test that alone to see if it's working at all like this (get rid of everything else in your htaccess file to limit the test):
RewriteEngine On
RewriteRule ^(.*)$ http://www.google.com [L,R=301]
Any request to your site should go to google if the configuration for apache is correctly set.
I have a .htaccess file on a WAMP server. The .htaccess Rewrites work fine...for some easy url rewrites, but I can't get it working on a simple test.
My .htaccess
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^Homepage/$ index.php
RewriteRule ^Test/(.*)/$ test.php?a=$1
On my test.php I'm dumping out $_GET.
My Homepage works fine, i.e. http://www.mysite.com/Homepage/ is redirecting just fine. But my Test page is only partially working in that it goes to the test.php but nothing is getting dumped from my $_GET dump - it's just an empty array.
Ideally I need to do this for multiple folders, e.g.
RewriteRule ^Test/(.*)/(.*)/(.*)/$ test.php?a=$1&b=$2&c=$3
...but I can't even get my simple test working.
BTW - this same .htaccess works perfectly in my Linux environment (dev server). I now need to move this to a production Windows box and it's simply not working.
If it helps this .htaccess file is sitting in a subfolder e.g. C:\wamp\www\mywebsite\.htaccess
What am I doing wrong? Any ideas? Thanks in advance.
UPDATE:
Turned on Rewrite Log (substitude real website name with mywebsite) and http://www.mywebsite.com/Test/ABC/ returns this:
217.42.222.22 - - [31/Mar/2011:23:08:16 +0100] [www.mywebsite.com/sid#65f3f0][rid#1a13a68/subreq] (1) [perdir C:/wamp/www/mywebsite.com/] pass through C:/wamp/www/mywebsite.com/test.php
217.42.222.22 - - [31/Mar/2011:23:08:16 +0100] [www.mywebsite.com/sid#65f3f0][rid#1a2ea88/initial] (1) [perdir C:/wamp/www/mywebsite.com/] pass through C:/wamp/www/mywebsite.com/test.php
217.42.222.22 - - [31/Mar/2011:23:08:16 +0100] [www.mywebsite.com/sid#65f3f0][rid#1a24af0/subreq] (1) [perdir C:/wamp/www/mywebsite.com/] pass through C:/wamp/www/mywebsite.com/ABC
I'm still none the wiser ;-)
Two suggestions:
post the url that you're using for the Test page.
turn on the rewrite log and see what it says. Just be sure to turn it off again later!
Have your rewrite rule like this:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^Homepage/$ /index.php [R=301,L]
RewriteRule ^Test/(.*)/$ /test.php?a=$1 [R=301,L]
target of rewrite rules should start with a /