I've finally got the mod_rewrite rule down somewhat, but would like to do a bit more with it and am not sure how. Here's what I currently have:
RewriteRule ^rider/(.*)/(.*)*$ /bar/standings/rider.php?lnum=$1&short=$2
Which allows me to do this:
http://pca.localhost/rider/214142/sme
instead of
http://pca.localhost/bar/standings/ride...
I would like to redirect all connections from htt_p://www.example.com/abc.html to HTTP_S://www.example.com/abc.html . What mod_alias or mod_rewrite commands would work for this? I've tried:
RewriteEngine on
RewriteCond %{HTTPS} =off
RewriteRule $abc\.html^ https://www.example.com/abc.html [R]
in both .htaccess and httpd.conf but that ...
I own a Linux-Apache site where I host exe files for download.
Now, when a user clicks this link to my site (published on another site):
http://mysite.com/downloads/file.exe
I need to dynamically check their user agent and redirect them to either
http://mysite.com/downloads/file-1.exe
or
http://mysite.com/downloads/file-2.exe
It seem...
I'm a real newbie regarding mod_rewrite so please don't laugh. I am using this tool for testing: http://civilolydnad.se/projects/rewriterule/
Basically I want to rewrite
http://hostname/spanish/whatever/
into
http://hostname/whatever/?lang=es
Here's the best I could come up with:
RewriteRule ^spanish/(.*)$ $1?lang=es [QSA,L,NC]
...
How can I use URL rewriting in .htaccess to redirect to different domains depending on the URL?
Examples:
http://ONE/ to http://TWO/
http://ONE/some_content to http://THREE/some_content
...
Is it possible to have apache get a request like whateverProtocol://localhost and redirect it to http://localhost?
Thanks in advance.
Update: Thank you for the answers. Specifically, I am trying to redirect ldap : // localhost to http : // localhost -- and I believe ldap may be recognized by mod_rewrite. But no luck so far using Rewri...
I try to access the following url on my site but get a 404 error: http://www.example.com/minify/1232681243/skin/frontend/default/default/css/boxes.css
My path on the server is public_html/example
My .htaccess file is as follows:
RewriteBase /
############################################
## workaround for HTTP authorization
## in CGI e...
Hello, I'm getting some strange rewriting going on and was curious if anyone could shed some light. It's basically a pretty urls scenario, redirecting non existent path structure to a php script. The one difference is it checks for an existing file first:
RewriteEngine On
RewriteBase /test/
# if path begins in 'a' dir, & not a file, re...
I would like mod_rewrite to redirect all requests to non existing files and folders, and all requests to the main folder ("root") to a subfolder. So i've set it up like this:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC,OR]
RewriteCond %{REQUEST_URI} / [NC]
RewriteRule ^(.*)$ /my/sub...
I am trying to create a RewriteRule for paths but not for files. This code works for paths but if a file is requested such as an image or CSS file this is also pointed to the index.php file which is incorrect behavior!
RewriteRule (.*)/(.*) index.php?$1/$2
Any ideas how to fix this!? Thanks Matt!
...
I'm trying to write a simple rule such that:
/page gets implicitly routed to /page.php. Inversely, I'd like any direct access to /page.php to be redirected in the address bar to /page.
Currently I have:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
But that d...
I'm trying to modify my web page, which I currently use QueryStrings to display pages, and want to change website URLs to "search engine friendly" ones.
I'm a newbie in regular expressions and also in .htaccess file, and I want to change URLs from
http://someaddress.bla/index.php?lang=en&rootCategory=$rootCaty&leafCategory=$lea...
This should be a very simple question to answer.
How would I setup a .htaccess file to send visitors from mydomain.com to www.mydomain.com?
I just had some Ajax headaches caused by the same-source rule, and this should be an easy way around it.
...
Im new to mod rewriting. Could some one tell me how to change this url
ttp://example.com/blog/index.html?page=1
to
ttp://example.com/blog/page/1
Thanks a bunch!
Kohei
...
I currently have the following code to rewrite search engine friendly url's to something PHP can handle however there are a few issues.
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*)/(.*) index.php?$1/$2
This Rewrites: domain.com/cat/mens/size/large/
To This: domain.com/index.php?cat/men...
I'm trying to parse hostname only from the Apache server variable HTTP_REFERER and I'm wondering if it's possible with mod_rewrite since my goal is to obtain the hostname and then rewrite the request.
...
I want to point to a sub directory file if it exists.
Currently I have in an .htaccess file at the webroot:
RewriteCond my_sub_dir/%{REQUEST_FILENAME} -d
RewriteRule ^.*$ my_sub_dir/%{REQUEST_FILENAME} [L]
Basically I want http://example.com/js/application.js to point to my_sub_dir/js/application.js if it exists
...
The path to my django site is: staging.ninjawebsite.com/clients/project/
I want that to be treated as the base url. The django project is in the public_html/clients/project subfolder. Everything seems to be working fine but all links to say /city/ should go to staging.ninjawebsite.com/clients/project/city/ but it goes to staging.ninjaweb...
I have the following RewriteRule on my Apache with ZendFramework in the back:
RewriteRule ^/account([0-9]+) /account?i=$1 [L]
Problem that I'm having is that I have an AccountController.php for ZendFramework, so URL from browser going to ...://myserver/account works just fine. However, when I have this rewriterule in httpd.conf, and p...
I have this .htaccess file in Wordpress. It's located at /public_html/ (web root). I need to exclude a folder (csNewsAd) from the rewrite engine. I've tried this, based from another question similar here at SO, but didn't work at all.
AddHandler x-httpd-php5 .php
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
...