mod-rewrite

RewriteCond on HTTP_HOST freezing up site?

I have a number of domains pointed to the same webserver and would like to set it up to rewrite all incoming traffic to be under one consistent domain. I have done this before do make sure that the request has a www. in it, but when I added the script below to be site it started freezing up. RewriteCond %{HTTP_HOST} !^www\.domain\.com(...

PHP script not decoding URL parameters in $_REQUEST[] (%20 values present) after deploying to 5.2.4

I have developed a PHP script that uses $_REQUEST[] superglobal. A typical client request might consist of: http://host.name/socnet/add.php?shortid=1&author=NewUser2&comment=Dad%20dad%20dad This URL is rewritten by Apache in my production environment to an equivalent https:// URL according to the following rewrite rule: Rew...

Filtering web folders via Apache and PHP

I'm looking for a way to filter and control access to a folder on a website. However, what I'd like to do is filter the access requests via PHP and Apache, a little like the way filters are implemented in Java. So, when a user tries to visit http://www.mywebsite.example/files/afile.zip I'd like it first to pass through a PHP script t...

URL rewrite in smarty based website?

I wanted to achieve this example.com/search_results/?action=search&username[equal]=PorscheSA to example.com/PorscheSA I have used .htaccess for many websites to achieve this, but since this website is smarty based, it doesn't seem to work. Any help will be much appreciated. Ok, this is the .htaccess file: RewriteCond %{HTTP_HOS...

RewriteMap not working in mod-rewrite

I have been trying to do simple maping with RewriteMap directive in my htaccess, but for some reason i am getting error 500 everytime. my syntax is .. Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteMap name2id txt:nklist.txt RewriteRule ^/name/(.*) /name_list_view.php?kid=${name2id:$1|NOTFOUND} in nklist.txt : 1 Da...

How to configure jboss rewrite valve settings

Hi all, I am developing a web app. using struts2 and jboss url rewrite valve as you see from the title. What i want to know is which are the neccessary jboss configuration files to configure rewrite valve settings? Besides, I couldn't find any information in order to fix my non-english character problem while url rewriting. Some flags l...

Force HTTPS on certain URLs and force HTTP for all others

I have a client project where I need to force HTTPS for a certain folder and force HTTP for all others. I can sucessfully enforce HTTPS for the folder I desire but then all links back to the rest of the site end up being through HTTPS. I'd like to have a rule which forces requests for anything 'not' in the secure folder to be forced back...

Wordpress Custom URL Rewrites

I have links in my site that pass queries to pages that query from an external database. This works fine e.g. mysite.com/catalog/?tl=flooring however i want to rewrite this url to appear as mysite.com/catalog/flooring Ive tried modifying the rewrite rules in wordpress but it always displays the index page add_filter('rewrite_rules...

Adding apostrophe/single quote to my RegEx match

I'm using [A-Za-z0-9_-] to match letters, numbers and _ and - in my regular expression. I'd like to add the ' character to it but most of my attempts result in server error 500. Here's the full line from my htaccess: RewriteRule ^[A-Za-z0-9_-]+/?$ /index.php ...

How do I replace spaces into hyphens in an URL.

I have some data that is inputted into to a database with spaces. e.g. first and last names. I then need to call that data from the database and display it as a link so i have a friendly URL. I am not sure if I should do this with mod-rewrite or php. What is the best solution? A solution like below doesn't seem to work str_replace('- ...

Redirect Query_string

I need help, again. I am trying to do the redirect, but it is not working. I want to redirect: http://www.example.com/page/168?s To: http://www.example.com/page/168 Using RewriteCond %{QUERY_STRING} ^q=s$ RewriteRule ^(.*)$ http://www.example.com/$1? [R=301,L] Thank you ...

Making ExpressionEngine .htaccess allow commenting on index.html

I've got a really quirky issue going on with ExpressionEngine. I've got a live test site here. Essentially, if you attempt to comment on the index's 'Question of the Day,' you get a proper redirect, but the comment never gets to the database. If I remove my .htaccess and set the site's index page in my control panel to index.php, then ...

htaccess url rewrite

i have a htaccess file which redirectes all the requests to index.php RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule .* ./index.php My question is i would like to make a redirect to folder which doesn't exist and it should not affect the present htaccess redirects to index.php. since it is linked ...

htaccess mod_rewrite subdomains inheriting rules from main domain

I want to redirect m.example.com to example.com/index.php?type=mobile while inheriting the rules I've already written for example.com... So, say, I have N rules already defined looking something like: ^view/([A-z]+) index.php?view=$1 ^delete/([A-z]+) index.php?delete=$1 ^page/view/([A-z]+)/([0-9]+) index.php?view=$1&page=$2 ^page/del...

configuring search engine friendly url (mod_rewrite)

i want to understand at least abit on how the .htaccess works. i am using the .htaccess from zend framework (since thats what i use often) SetEnv APPLICATION_ENV development RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] Rewr...

Find urlRewrite rule

I am developing a webshop and I'm making it SEO friendly, so I use urlRewrite to have a "nice" and "clean" URL. I am having products in categories, and I'm having filters for products search. I would like to have something like: www.website.com/motor-oils/filters/volume-1L/weight-4Kg/price-500/ i would use the following rule: Rewri...

RewriteRule that preserves GET parameters

What is wrong with this rewrite rule? RewriteRule ^api/(.+)$ api/index.php?url=$1 [L] I simply want "index.php?url=" to be added after api/ and before the rest of the get parameters. api/image/upload&arg1=1&text=lorem+ipsum to api/index.php?url=image/upload&arg1=1&text=lorem+ipsum What is wrong with (.+) to get everything after ...

.htaccess: block a physical directory url but allow the url through a subdomain indirectly

So for security reasons, I want to disallow http://www.domain.com/directory/ but allow that physical directory only through http://subdomain.domain.com/directory/ The simple way would be to just move the directory, but I can't do it because it breaks the application, so how would I do this with .htaccess? I've temporarily blocked it u...

Are ifModule mod_rewrite tags redundant in .htaccess mod_rewrite files

Are the following opening/closing tags necessary for .htaccess mod_rewrite's? I've had .htaccess working without those, but just checking up on htaccess tutorials, many include this tag. <IfModule mod_rewrite.c> ... </IfModule> ...

htaccess mod_rewrite referencing to full path directories

Is it possible to reference a full/absolute path directory, such as /usr/home/public_html/x in .htaccess mod_rewrite? I've tried the most obvious case of putting the following in the .htaccess of a subdomain (stored in a folder in public_html), hoping it'd map (not redirect!) onto the file as pointed by the absolute directory: RewriteE...