I am in need of the rewrite rules and conditions to evoke a central PHP script for every and any web document requested on my server. Just to add, I do not want the PHP script to be evoked when requests are made for CSS, JS, PNG, GIF, JPG, and other media etc. I only want the script to be called for HTM, HTML and PHP documents in the roo...
Background, I'm running a Zend Framework application. Trying to squeeze the most performance out of it as possible. So I'm trying to move the rules out of .htaccess exactly to the letter per this blog post by the author of a Zend Framework book: http://www.armando.ws/2009/03/how-to-run-zend-framework-with-no-htaccess-file/
So basically,...
Is there anyway to use the value set in a SetEnv on the RewriteRule statement?
Example:
SetEnv MY_SCRIPT myScript.php
rewriteEngine on
RewriteRule ^(.*)$ %{MY_SCRIPT} [L]
...
I need to decide on naming conventions for a new website.
I can use mod_rewrite at will.
My favourite solution would be to work with no file extension at all.
www.exampledomain.com/language/pagename
this would lead to "pagename" being treated as a directory. I would have to take that into account when using relative links.
Are there...
I want to write a rule that redirects all URLs of a certain pattern to a PHP file. Exception: the control/ directory where the CMS resides.
Why does
RewriteCond %{REQUEST_URI} ^/([^control]+)/([^/]+)$
RewriteRule .* /pages/index.php?language=%1&page=%2&%{QUERY_STRING} [L]
not work for
domain.com/deutsch/start
(it throws a 404...
I need to remove a cookie from the HTTP request that gets to the server. Doing it on the client (that writes this cookie) or on the server (that reads it) is not an option. I have Apache 2.0 that proxies requests between client and the server, so I was hoping to remove the cookie right there in Apache using mod_rewrite.
My question is,...
I want to rewrite everything that uses this pattern...
/test/?TEXT=TRUE and allow it to be /test/TEXT AND /test/TEXT2, and so on.
...
I would like to change the rewrite rule to only apply to the current folder that the htaccess file is in
RewriteEngine on
RewriteRule ^(.*)\.html $1\.php
how do I change this to make that work?
Thanks,
...
I used to have the following rule in my .htaccess while building a website:
RewriteRule ^test/(.*) cgi-bin/router.py?request=$1 [NC]
Whenever the user goes to mysite.com/test/something they get redirected to cgi-bin/router.py?request=something. This worked very well.
I have now finished the site and want to 'turn it on'. However simpl...
I need to send all requests for the directory home/alphauser to backend/alphauser, but not requests to files inside the home/alphauser directory. For example:
http://home/alphauser -> http://backend/alphauser
http://home/alphauser/ -> http://backend/alphauser
http://home/alphauser/icon.png -> http://home/al...
I'm getting a vulnerability alert from Mcafee Secure saying that there is an XSS vulnerability on my site. The string they use to produce it is:
https://www.mywebsite.com/%3E%22%3E%3Cscript%3Ealert%28123%29%3C/script%3E%3C%22/www.mywebsite.com/my-product.html?ref=443%2Fanother%5Fpage%5Fon%5Fmy%5Fsite.php
I can't get the alert to disp...
Here is my .htaccess file
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteRule subpage\?sid /index.php [R=301,L,NC]
My request is http://example.com/subpage?sid
It keeps returning 404 Not Found, rather than redirecting to index.php
I have tried not escaping the ? and changing the request to http://example.com/subpage\...
I have the following in a .htaccess file as a test:
RewriteEngine on
RewriteRule ^(.*)$ /backend/$1
This works as expected. I was able to get rewrite logging working with the following in apache2.conf:
<IfModule mod_proxy.c>
RewriteLog "/tmp/REWRITE.log"
RewriteLogLevel 9
</IfModule>
The log file is created and logs debug inf...
I have a PHP-Apache application using mod_rewrite for clean URLs. I am having a lot of touble getting certain pages and paths forced to HTTPS while also ensuring all others will remain as HTTP.
Here is an example of what I mean:
// http://www.example.com/panel/ -> Should always redirect to HTTPS
// http://www.example.com/store/ -> Sho...
I'm trying to get Apache mod rewrite to work on my local machine. I'm running OSX with PHP 5 and the Apache mod rewrite module is enabled.
I have a directory called localhost/~Jason/hfh/admin with various PHP includes called based on a $_GET variable. I want to let users type (in theory)
localhost/~Jason/hfh/admin/pages
and have tha...
Hi,
this is yet another .htaccess question. And I already did my literature review. Would appreciate any help.
Requirements:
Force HTTPS only for a few URLs.
Browser shouldn't say partially encrypted page for SSL pages.
I am using CodeIgnitor and tweaked the *base_url* in config.php to:
$config['base_url'] = (isset($_SERVER['HTTPS...
I need to redirect a single Wordpress URL that is formatted like this: www.bluewidgets.com/?p=123 to a clean URL on another domain. How can I do this via .htaccess? All of the tutorials I've seen say that I need to specify another part of the url, like index.php, before the query string, but my URL doesn't have one - it's just the domain...
Trying,
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* - [F]
RewriteCond %{HTTP_HOST} ^(.*)dev\.example\.edu$ [NC]
RewriteRule ^/test(.*)$ http://dev.example.edu/test/index.php/test$1 [NC]
</IfModule>
on an apache 2.2 server, to get this rewrite working to hide the "index.ph...
I have a development site on my machine at
localhost/~Jason/hfh/admin/?admin=collections
My .htaccess file is in the /hfh/admin/ directory. It says:
RewriteEngine On
RewriteBase /~Jason/hfh/
RewriteRule ^([A-Za-z0-9\-\_]*)$ index.php?admin=$1
But when I go to
localhost/~Jason/hfh/admin/collections
I get a "page not found" error...
We have a client who has many branches around the UK. Some of their branches have their own sites with their own domain names. The client has a part built system where visiting:
www.client.com/aboutus.php?id=branchId
shows the About Us page for that particular branch. What I need is a way to map specific domains to their branchId (thi...