mod-rewrite

mod_rewrite allow percentage sign in url

I have a rewrite rule RewriteRule ^([A-Za-z0-9\/\-\_]+)+$ .?p=$1 [L] But if I have % sign in url, it won't work. How do I modify this rule to work with percentage sign? ...

301 redirect urls

Hi I'm trying to redirect an old url to a new one using 301 I need an example of RewriteQueryString for the following 301? http://www .example.com/search/?depId=1&typeCatId=1 to the following http://www.example.com/mens/clothing So when I type in the long URL in the browser, I am redirected to the new, shorter URL Any ideas? ...

mod_rewrite and server environment variables

Hi Guys, The setup I have is as follows: I have one Apache server acting as a URL rewriting engine (SERVER1). I have a second server (Apache too) which runs a web application (SERVER2). First tries to authenticate users. Part of the authentication protocol involves a lot of redirection between that application server and the authen...

Rewriting URLs in htaccess

I am trying to rewrite some url's. All the Urls look something like this www.domain.com/index/c/index/ www.domain.com/index/c/about/ www.domain.com/index/c/store/ I would like these urls to look like the following: www.domain.com www.domain.com/about www.domain.com/store I have tried several different things in the htaccess file but ...

How to detect root folder in URI when using apache mod_alias and mod_rewrite?

How to detect root folder in URI when using apache mod_alias and mod_rewrite? I have an website running on a sub folder in of the document root for example /var/www/this/an/other/dir in this folder I have a .ht_access file with mod_rewrite rules to redirect everything to index.php # Do nothing if the file (s), link (l) or (d) exists Re...

Append Query String via Apache Rewrite Rule

How can I rewrite the following: http://www.mydomain.com/my-page.html to http://www.mydomain.com/my-page.html?type=1 Tried the following without any luck: RewriteRule /car-covers.html$ /car-covers.html?type=$1 [R=301,L] RewriteRule ^car-covers.html$ car-covers.html?type=$1 [QSA,L] ...

.htaccess how to substitute urls

How can I substitute URLs of a web application in a sub folder as installed on root. e.g. need to map example.com/index.php to example.com/new/index.php I do not want redirection but url rewrite to exempt folder name. Help me to learn and define rules. ...

Doesn't recognized my css, js, and so on...

I have .htacces like: RewriteEngine On RewriteRule ^en/$ index.php?page=index&lang_id=2 RewriteRule ^contact.html$ index.php?page=contact RewriteRule ^en/contact.html$ index.php?page=contact&lang_id=2 # ...[and so on] In my site i have a switch language button(image). My basic language is in Ro and and i want to swtich ...

Multiple fullstops in regex for RewriteRule

I use the following rule to redirect pretty urls from http://hostname.co.za/geoip/123.12.123.34 to http://hostname.co.za/geoip/index.py?ip=123.12.123.34 .htaccess in /geoip RewriteEngine on RewriteRule ^(.*\..*\..*\..*)$ /geoip/index.py?ip=$1 This works fine to match only ip's, but when I try this, it gives a 500 server error: Rewri...

How do I stop my .htaccess file causing a recursive redirect

Using the following .htaccess to redirect my query to fcgi scriptI get a recursive redirect problem. Can anyone suggest what needs tweaking? AddHandler fcgid-script .fcgi RewriteEngine On RewriteCond %{HTTP_HOST} !^answers.mynewdomain.co.uk$ [NC] RewriteRule ^(.*)$ http://answers.mynewdomain.co.uk/$1 [R=301,L] RewriteCond %{REQUEST_F...

URL Redirection but keep url

I have a url test.html and a url test2.html. What I am trying to do is have it redirect test.html to test2.html but keep the same url. so far I tried this: RewriteEngine on RewriteRule ^test.html$ test2.html and put it in a .htaccess file which I put in the same folder as the other two files. It just caused the whole site not to load...

What is correct nginx location rules to match only the first path element in the URI to the CGI executable?

I am using a FreePascal web module designed for apache cgi-bin with nginx. The CGI itself is called spidersample.cgi and contains modules such as hello, bye etc. With Apache when spidersample.cgi/hello is called, spidersample.cgi gets executed, and passes control to the hello subroutine it contains. With nginx instead of executing sp...

make example.com/user/Bob go to profile.php?user=Bob

My current http access file is # Pound sign comments a line out # Disallow viewing of htaccess files <Files .htaccess> order allow,deny deny from all </Files> Options +FollowSymLinks RewriteEngine On # enable hiding php extension RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*)$ $1.php ...

[mod_rewrite] redirect ex-ample.com/asdf to example.com/asdf

Hi, I want to redirect all requests from ex-ample.com to example.com. The url structure should remain the same, I only want to "replace" the "-" in domain... http://www.ex-ample.com/asdf123 redirects to: http://www.example.com/asdf123 thanks! ...

.htaccess profile rewrite help

RewriteRule ^user/(.*)/(.*) profile.php?user=$1&v=$2 [L] works for http://10.0.1.5/user/Kevin/wall/ if i do http://10.0.1.5/user/Kevin/wall it 404's. if i do http://10.0.1.5/user/Kevin/ it 404's if i do http://10.0.1.5/user/Kevin it 404's I tired RewriteRule ^user/(.*) profile.php?user=$1 [L] RewriteRule ^user/(.*) profile.php?u...

Htaccess non-www and strip index.php in a nice way

I'm having some trouble with my .htaccess redirections. I want a situation in which the (non-www)domain.tld is redirected to the www.domain.tld. And I want to rewrite the arguments to skip the index.php, making a request for /foo go to index.php/foo. Initial situation First I had these rules RewriteCond %{HTTP_HOST} ^domain\.tld [NC]...

Rewrite subdomain

Obviously a pretty simple question: how do I rewrite (value1).example.com/(value2) to /(value1)/(value2) I've tried a couple of things without success. Thank you in advance. ...

Help with .htaccess file. mod_rewrite for custom urls?

Situation: I have a few hundred posts each belonging to a particular category. A] Now when the user visits the home page, the content is irrespective of the category sorted by date. http://www.example.com He can navigate through different pages like: Type 1: http://www.example.com/3 which corresponds to http://www.example.com/inde...

Apache mod_rewrite domain to subdomain?

Hello, I have this address http://www.example.com and have this page http://www.example.com/world. Can I do this with mod_rewrite,to my page become http://world.example.com ? Any link,tutorial,...,will be nice,if I can do this? And what will be with these links for example: http://www.example.com/world/some-other-page http://www.ex...

htaccess rewrite breaks relative paths

Hi, I have an htaccess file which maps http://www.myserver.com/home/ to http://www.myserver.com/index.php?section=home This part works fine. The issue I am facing now is, all my images and css reside in a sub-folder named assets, i.e. http://www.myserver.com/assets/images/ http://www.myserver.com/assets/css/ etc. After redirection the...