mod-rewrite

(Apache) Possible to match UTF8 characters in rewrite rules?

I know it's possible to create links where UTF8 characters are encoded, but is it possible to actually match those characters within rewrite rules? Example being just rewrite a static page in utf8 cyrillic russian text to some other page. ...

Redirect subdomain on tomcat through apache server with mod_jk

Hi, I have a Tomcat (6.0.20) and Apache Server setup (2.2) and am trying to redirect all subdomains to a specific context, on my domain. e.g., s.example.com redirect to www.example.com Apache is fowarding requests via mod_jk (I tried mod_proxy, but the css and js didn't load as its not absolute urls). My current setup: httpd.conf: ...

Using .htaccess to control HTTPS on certain pages

I've got a site that requires (obviously) HTTPS for checkout. The current fix put in place involved making the whole site run in SSL mode, but this is causing problems. How would I change this... RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L] To only set a certain URL (say basket.php) as HTTPS? ...

RewriteCond and RewriteRule in .htaccess

I have a client folder located at http://www.example.com/client However, I've now installed SSL on the server, and want to add a permanent redirect using HTACCESS so that whenever /client is accessed, that it redirects to: https://www.example.com/client Anybody know how to do that? I've redirected my domains in the past like this: Rew...

Debugging Zend Framework in Eclipse, mod_rewrite problems

I have a simple ZF that already works well. I've set it up to work in a subfolder, so I access it with localhost/zftutorial URL. Now the time came for debugging, but when I execute debugger in Eclipse, it appends debug URL params (like XDEBUG_SESSION_START=ECLIPSE_DBGP) which break everything and I start getting this message: > *Zend_C...

Apache's mod_rewrite and %{REQUEST_URI} problem

Hi, suppose we have the following PHP page "index.php": <? if (!isset($_GET['req'])) $_GET['req'] = "null"; echo $_SERVER['REQUEST_URI'] . "<br>" . $_GET['req']; ?> and the following ".htaccess" file: RewriteRule ^2.php$ index.php?req=%{REQUEST_URI} RewriteRule ^1.php$ 2.php Now, let's access "index.php". We get this: /index.php n...

htaccess Rewrite issue

How could I use a rewrite to change: /?tag=foo To: /tag/foo I tried: RewriteCond %{QUERY_STRING} ^tag=(.+)$ RewriteRule ^(.*)$ http://www.example.com/tag/$1 [L] But it did not work. ...

mod_rewrite for clean urls gives 500 internal server error

I'm having some troubles with mod_rewrite. On my index page (index.php) I show a blog and a single blog post page looks like this: http://www.mydomain.com/blog/post-title mod_rewrite for this is: RewriteRule ^blog/([A-Za-z0-9-]+)$ index.php?postslug=$1 [L] This works like a charm. But I also have another page called artists.php and...

Apache mod_rewrite

Options +FollowSymLinks RewriteEngine On RewriteMap name2id txt:/path/to/map.txt RewriteRule ^/mods/([^/]+)\.html$ /mod.php?id=${name2id:$1|0} [QSA,L] First time to make a URL rewriting with rewriteMap. I have a code above but it returns a 404 page if i run http://example.com/mysite/mods/abc.html in my browser. I've put the above cod...

mod_rewrite to overwrite calls to html root

Just a quick little thing, but i can't get past it. So, say you would have in your html files references to images and css files, something like this: <img src="/img/myimage.jpg" />, and so on. Now, if you wanted to add a mod rewrite rule to map those addresses to something like /subset/img/myimage.jpg, how would you do that? As far a...

Apache .htaccess rewrite question

i wanna add a rewrite rule to apache 2.2 .htaccess file that if the rest of the rewrite rules did not comply and if the url is not found, to redirect to a specific php file. how do i do that ? ...

Htaccess Redirect

I am looking to make www.purchase.example.com redirect to purchase.example.com, below is an example of what I am trying to do: RewriteCond %{HTTP_HOST} ^www\.purchase\. RewriteRule (.*) http://purchase.DOMAIN_NAME/$1 [L,R] I need a variable that will replace DOMAIN_NAME with simply purchase.example.com. Obviously I can hard code the ...

diff in mod rewrite on apache 1.3 and 2.2

What is the difference in mod_rewrite between Apache 1.3(.37) and 2.2(.11)? RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^pages/edit(account|page)/([0-9]+)*$ ./index.php?p=edit$1&id=$2 RewriteRule ^pages/([\w'-]+)*$ ./index.php?p=$1 I wrote this and it "works on my machine" which...

WAMP + RewriteRule : Copying site to subfolder

I've just installed WAMP, and now I'm trying to copy my files from my server to my local machine. I have a rewrite rule like RewriteRule .* /index.php?url=$0 [L,QSA] But that seems to redirect to http://localhost/index.php when I actually want http://localhost/mysite/index.php. So I figured RewriteBase /mysite Would do the trick, b...

Conditional Regular Expression - Separate characters from dashes in URL and test if first character set (string) is numeric

How would you create a regular expression that would parse the following url http://example.com/answers/38-my-example-question-on-regular-expression Specifically, "/answers/38-my-example-question-on-regular-expression" versus "/answers/category" If the regex finds "38" a number, then it does this: RewriteRule answers/([-_~*a-zA-Z0-9]...

Is my htaccess file causing multiple calls to one page?

Hello all, I think my htaccess file that makes use of mod_rewrite is causing my pages to be called more than once. Can anyone see if this could happen with my current htaccess file? Or if there is even a possibility? This happens in the view.php page only (from what I have seen). # REWRITE DEFAULTS RewriteEngine On RewriteBase / Rewri...

htaccess mask dynamic url with a static url

I'm trying to do something with .htaccess that I'm not sure can be done. First thing I did is hide the .php extensions using the following code: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php Works great. Now what I'm trying to do and can't seem to figure out is...

Problem when removing index.php from url

hi friends, dont worry it is not an another how to remove index.php from url question!! :D i researched and made according to tutorials; here is my source http://codeigniter.com/wiki/mod_rewrite/ im sure about all steps, but when run it, i dont see any error message… url changes like www.blablabla.com/contact www.blablabla.com/about...

apache rewrite folder+query to query

How can I get Apache rewrite to do the following... take a url received as: domain/somename/index.php?query=1&anotherquery=2 and change it to: domain/index.php?query=1&anotherquery=2&name=somename cheers, Omer. ...

Do I need to do something with the .htacess file?

I have installed a PHP program onto my godaddy shared host (linux) account. I am now getting 404 errors. I have contacted support for the program but have not heard back. From what I am reading on various forums, there seems to be an implication that I need to change something in the .htaccess file. The only .htaccess file is in the "j...