The following is mod_rewrite config for Zend application(Refer to Rewrite Configuration Guide).
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
</IfModule>
I have installed mod_status and want to exclude /server-status URL from being processed by Zend Controller Dispathcer.
I have tried the following RewriteCond,but none of them work:
RewriteCond %{REQUEST_URI} !=/server-status [NC]
RewriteCond %{REQUEST_URI} !^/server-status* [NC]
RewriteCond %{REQUEST_URI} !(server-status) [NC]
And i got the following exception :
'ERROR CODE: 54dedae933247 - Page not found: exception \'Zend_Controller_Dispatcher_Exception\' with message \'Invalid controller specified (server-status)\' in /usr/share/php/project/libraries/library/Zend/Controller/Dispatcher/Standard.php:248
Stack trace:
#0 /usr/share/php/project/libraries/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#1 /var/www/myapp/application/My_Bootstrap.php(255): Zend_Controller_Front->dispatch()
#2 /usr/share/php/project/libraries/library/Zend/Application.php(366): My_Bootstrap->run()
#3 /var/www/myapp/public/index.php(43): Zend_Application->run()
#4 {main}'
I think i can exclude this URL by extending Zend_Controller_Action and in preDispatch, exclude this URL,but i do not want do this ,because i must change the code and for other the same situation i must change code(dirty solution),and sometimes and i can not access the code.
What condition must i include to exclude /server-status?
Related
I am trying to change .htaccess file.But changes are not reflecting. Laravel home page works properly even if .htaccess file contains errors.
I have gone through the checking of mod_rewrite enable and apache2.conf files.Everything is perfect but unable to find the issue.
gfdghfguf;l;..
hfjffgfgh
lghkjgkjg
jfghkfhjfgh ghggggggggggggb
Options -MultiViews -Indexes
RewriteEngine On
gb gjf jfhgj jfhg jhfjf g
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
It have to give 500 internal server error but it works fine.
I am trying to use a Bluehost supplied SSL wildcard certificate to switch one subdomain to HTTPS.
The web root contains many subdomains, and I only want to affect the test. subdomain.
Going into the web root, I've written the following .htaccess file:
RewriteCond %{SERVER_NAME} ^test.mydomain.com
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}$1
Yet hitting http://test.mydomain.com/admin/index.php does not redirect me to https://test.mydomain.com/admin/index.php.
Even cutting out the Condition of SERVER_NAME, it still doesn't work.
Is my rewrite rule bad?
Well, in the first place I was in the wrong .htaccess file. I needed to go to the directory for my subdomain.
Then, simply switching it from HTTP to HTTP apparently causes some kind of redirect to www. behavior.
I had to
A) Preserve the existing rules that were not intended for test.
B) Add the test. rules.
It added up to a lot.
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^test.example.com$
RewriteRule ^index\.php$ - [L]
RewriteCond %{HTTP_HOST} !^test.example.com$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{HTTP_HOST} ^test.example.com$
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{HTTP_HOST} ^test.example.com$
RewriteCond %{REQUEST_URI} !^/test/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /test%{REQUEST_URI}
RewriteCond %{HTTP_HOST} ^test.example.com$
RewriteRule ^(/)?$ test/admin/index.php [L]
I have problem with joomla mod_rewrite.
My hosting info:
Hosting - Shared - Deluxe - Linux
Joomla:
2.5
root directories:
domain1com (www.domain1.com)
domain2com (www.domain2.com)
domain3com (www.domain3.com)
For example let's take domain1com.
/domain1com/configuration.php
public $live_site = 'http://www.domain1.com';
public $sef = '1'; //Search Engine Friendly URLs ON
public $sef_rewrite = '1'; //Use URL rewriting ON
**/domain1com/.htaccess**
Options +FollowSymLinks
RewriteBase /domain1com/
RewriteEngine On
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule ^(.*)$ index.php [F,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
I'm having error when I try to load:
www.domain1.com/example
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator 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.
www.domain1.com/index.php/example
Works fine...
Any suggestions ?
Rewrite base is relative to the domain name not the file structure. Even though there are multiple folders in the system, from the domains perspective, it is the root. You should have RewriteBase /.
If you were accessing the site at www.domain1.com/domain1com/example then you would use RewriteBase /domain1com/.
I am having a problem setting up my Zend framework project.
I have xampp/htdocs/quickstart
my server name is mydomain.com. I want to access my project at https://mydomain.com/quickstart(note that i am using https, dont think if this could be a problem)
i used the following .htaccess
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [R,L]
RewriteRule ^\.htaccess$ - [F]
RewriteCond %{REQUEST_URI} =""
RewriteRule ^.*$ /public/index.php [NC,L]
RewriteCond %{REQUEST_URI} !^/public/.*$
RewriteRule ^(.*)$ /public/$1
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]
RewriteRule ^public/.*$ /public/index.php [NC,L]
And i am getting a 404 error , why does this happen?
I am sorry, i am no expert in configuring .htaccess. All i want to do is route all the requests in quickstart to quickstart/public. and to access my zend project at https://mydomain.com/quickstart/
i am getting a 404 error with above .htaccess(found on Internet)
My problem is is i already ahve other apps running on the server and i want to build a project on /quickstart. i also cannot create a subdomain. Can you please help me with proper .htaccess config.
Try with this,
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
I have the following rewrite logic in my vHost and everything seems to be working in regards to redirecting subdomains, but as soon as I add a path to the URI I'm getting an error in my apache_error.log.
Here is the rewrite logic:
RewriteEngine On
# Remove the www alias
RewriteCond %{HTTP_HOST} ^www\.13labs\.net$ [NC]
RewriteRule ^(.+)$ http://13labs.net$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^.+$
RewriteCond %{REQUEST_FILENAME} !\.(gif|jpe?g|png|js|css|swf|php|ico|txt|pdf)$ [OR]
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} !-d [OR]
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^ - [L]
RewriteCond %{HTTP_HOST} !^www\.13labs\.net$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.13labs\.net$ [NC]
RewriteRule ^(.+)$ /index.php?subdomain=%2&kohana_uri=$1 [PT,L,QSA]
RewriteRule ^(.+)$ /index.php?kohana_uri=$1 [PT,L,QSA]
I am trying to hit admin.13labs.net/login, which should be rewriting to 13labs.net/index.php?subdomain=admin&kohana_uri=/login. However, in my apache_error.log I am receiving the following:
[Mon Aug 30 23:56:06 2010] [error] [client 74.63.151.37] File does not exist: /var/www/13labs.net/html/login
Any clues? I've been playing around with this for about an hour now and I'm stumped...
Regards,
Andrew
Your second rewrite rule (with its corresponding conditions) looks like it'll stop rewrites for any URL. It matches if the file doesn't have the right extension, OR isn't a file, OR isn't a directory, OR isn't a link. No resource can be a file and a dir and a link at the same time, so all URLs will match -- and they'll all get passed as is, since your [L] flag prevents any subsequent rewrites.
If your intention is to prevent rewrites for URLs that correspond to existing files, links, or directories, remove the !'s from your conditions and remove the [OR] from the condition that checks the file extension.