I have a search form on the page and I use GET method to send data to the server, but when I type backslash and click search, I see a 404 error. It is for "\" in URL. How can I prevent it?
http://127.0.0.1:8080/SelfArea/wpzf/public/\
Apache server configuration htaccess file:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
Windows 7, WAMP Server.
Few things to note:
Point 1. Your browser should convert backslash to frontslash. Many browsers have "updated stuff" example: you cannot run direct javascript from address bar anymore in Chrome. However, a good programmer will always imagine a user to be more dumb than monkey, so your question makes perfect sense!
Point 2. If you are accepting parameters then, you might want to strip slashes using:
Stripslashes Function
Point 3. This will not be an issue in Linux system because, windows and linux both have different filing structure. Trust me, it will be ok :)
EDIT:
PS: You might want to test it on linux machine by putting it on "free hosting services"! that is , if you do not have a server already.
There are 2 step to load the page when routing error occurred in laravel :-
Add index.php in url the localhost/project_name/index.php/page_name
Edit apache2.conf from etc/apache2 Do following :-
<Directory /usr/share>
`AllowOverride All`
`Require all granted`
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>`
It will work fine handle all routing error.
Related
I am trying to configure captcha field with powermail. It always throwing error Captcha: Falscher Captcha Code eingetragen, bitte erneut versuchen!, I tried to investigate the causes of the issue. I found if I remove below rewrite rule from .htaccess
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^.*$ %{ENV:CWD}index.php [QSA,L]
...then it's working correctly and form submission will succeed. But, this will lead you to another problem. As rewrite rule above redirect you to index.php if the file/symlink/directory does not exist, So this won't work. Now, your home page will work fine but inner pages will lead you to 404 error.
See:
Here is my apache configuration for virtual host:
<VirtualHost *:443>
ServerName www.relaunch.typo-site.de
ServerAlias relaunch.typo-site.de
<Directory "/var/www/html/relaunch">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Can anyone help me with this? I found a similar open issue at the Github repository.
Until 9.5 i used sys_domain for redirecting Domains.
For example: I had a Domain example.com and set a redirect to example.info.
When a user called example.com/contact it redirected to example.info/contact.
Now, with TYPO3 9.5, it won't work anymore. When setting up a redirect for this domain (sourcepath: /, Respect get: no, REGEX: no) and calls example.com/contact it throws an error.
When change the setting to regex: yes & source path (.*?), it just redircts to example.info - contact is forgotten.
Is there a way to get the 'old' functionality back?
It is not possible to automatically prepend the source path to the destination with the redirects module. Just redirect such domains via .htaccess:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$ [or]
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^(.*) https://example.info/$1 [L,R=301]
I've built a new site for our company, whom I recently started working for, and deployed it on a separate subdomain (http://site.mysite.com) to not interfere with some URLs that need to remain on the old subdomain.
The old HTML site (http://www.mysite.co/site) was, for some weird reason, placed inside the public/ folder of a Zend application, as public/site. We want to redirect this site, which used to be available on http://mysite.com/site folder, to our new site at http://site.mysite.com
I've edited the existing .htaccess file, inside the Zend public folder so it looks like such:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mysite.com [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,NC,L]
# These four lines are my only alterations to this file...
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/(apps|site).* [NC]
RewriteRule .* http://site.mysite.com/ [R=301,L]**
RewriteRule ^cart/selectaddress$ https://%{SERVER_NAME}/cart/selectaddress [R,L]
Redirect 301 /photobook-sa http://www.mysite.com/photobooksa/
Redirect 301 /photobook-SA http://www.mysite.com/photobooksa/
Redirect 301 /photobookSA http://www.mysite.com/photobooksa/
RewriteRule ^channel\.html channel\.php
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]
php_value session.auto_start 0
RewriteRule ^.*$ index.php [NC,L]
Header append P3P "CP=\"HONK IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA\""
AddDefaultCharset UTF-8
The idea is to trap http://mysite.com/apps/, http://mysite.com/apps/whatever and http://mysite.com/site/ and redirect these all, unconditionally to http://site.mysite.com
The problem is, the redirection only works for /apps and apps/whatever, not for /site. So I discovered the public/site folder, which strangely hosts the company site as a HTML only site, within a Zend project folder structure.
Problem is, when I delete this folder, the whole mysite.com and www.mysite.com domain fails, but for example mysite.com/apps still manages to redirect to site.mysite.com
So I tried editing public/site/index.php to look as follows:
<?php
header('Location: http://site.mysite.com'); exit;
and it works, but only for a few requests, then I get a server error.
I also tried adding a .htaccess inside public/site/.htaccess with the following:
Redirect 301 http://site.mysite.com
which also, works initially, but then fails with a server error after a few requests?
I have no idea what's up, no clue as to why the virtual host is dependant on the public/site folder to work, which not even mentioned in the virtual host setups.
I grepped all the controllers in the Zend application/controllers folder to try and see if I can find anything that remotely mentions this /site folder, but no matches found.
I'm pulling the hair out of my scalp with this strange behaviour, can someone please help?
Also last point, this is an Amason AWS server, which I'm not entirely familiar with, could it be that this server has something funny going on, that's non-standard in terms of Apache configuration, DNS setup or something mysteriously automagic?
We've not been able to resolve this issue, and unable to figure out why our methods work only for a few minutes. I'm suspecting something weird happening with Amazon AWS.
The only way we could fix, was by adding an index.html inside the culprit /site folder, using a small JavaScript snippet to redirect the site from the client side.
I have a Zend Framework application I've been working on my local machine, I've deploying it to a server but having .htaccess issues because some but not all routes fail with a "Page Not Found". Very weird that I can't access some controllers.
My .htaccess is:
RewriteBase /~user/path/to/app/public/
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
This error does not occur on the local machine, only on the server. The only thing I can see that is common to the controllers that have a "Page Not Found" error on the server is that the Controller names are camel case.
Controllers that work: CustomerController, InvoiceController, StockController. Controllers that fail: SuppliersStockController, StockTypesController.
If I try to do something like 'www.route/to/app/stock-types/' or '/stock.types/' I get an "Application Error".
You are seeing the effect of a case sensitive file system.
When you go to /stocktypes/index, ZF will look for StocktypesController.php and succeed on case insensitive systems like Mac OS X and Windows. On Linux however, it will fail.
If you go to /stock-types/index, then ZF will look for StockTypesController.php and will find it on Linux.
If ZF finds a CamelCased controller name, then it will look for a view folder with a hyphen.
I am running the Perl Dancer framework following the instructions written in Dancer::Deployment for running as a cgi-script. This allows me to display a default page for the '/' route, but I can't seem to do anything beyond that. For example, let's say that I want to request something like http://localhost/myroute and have that handled by the '/myroute' route handler. How would I pull this off?
I am using apache's mod_rewrite to direct my requests. Currently, if I try the above, I end up with a message like "The requested URL /cgi-bin/dancer.cgimyroute was not found on this server." Below is the contents of my .htaccess.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /cgi-bin/dancer.cgi$1 [QSA,L]
</IfModule>
I am running Apache 2.2 on Windows XP with Dancer 1.3030. I understand why I am getting the error message that I am getting. What I am looking for is some sample code for handling the "/myroute" route and perhaps some suggestions regarding any modifications that I should make to my .htaccess file.
The configuration needed a / after dancer.cgi:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /cgi-bin/dancer.cgi/$1 [QSA,L]
</IfModule>
Thanks to Quentin above.