RewriteCond %{QUERY_STRING} ^id=(.*)$
RewriteRule ^oldpage\.php$ http://new-site.com/newpage-%1 [R=301,L]
and
RewriteRule ^oldpage\.php$ http://new-site.com/newpage-%1? [R=301,L]
In first case result is
new-site.com/newpage-3?id=3
in second
new-site.com/newpage-3
What does question mark in second rewrite rule means?
...
I want to override the Timeout configuration of apache, only for one domain. I would prefer to be able to offer the option of overriding it in the htaccess, but manually configuring it in the VirtualHost configuration would be fine too.
Is this supposed to work?
Thanks.
...
I have a .htaccess in my root of website that looks like this:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.mydomain\.pl [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?([a-z0-9_-]+)\.mydomain\.pl [NC]
RewriteRule ^/?$ /index.php?run=places/%1 [L,QSA]
RewriteCond %{REQUEST_URI} !^/index.php$
RewriteCond %{REQUEST_URI} !^/images/
Rewrite...
I'm trying to enable Expires headers for images as recommended by YSlow. I'm sure I had this working before but now when I check YSlow it says they are not being cached.
For my .htaccess, I have tried:
ExpiresActive on
ExpiresDefault A0
<FilesMatch "\.(gif|ico|jpg|png)$">
ExpiresDefault A29030400
Header append Cache-Control "p...
This has got me completely foxed for a couple of days now, and I am convinced that I will look stupid once I solve it, but will be even stupider if I don't ask for help now.
I have mod_rewrite working successfully on my localhost (no vhosts involved; this is my laptop, my development machine), and I use .htaccess in various directories ...
I have two parts to a site, foo.domain.com and bar.domain.com (with bar.domain.com really being a CNAME to another host) I want users entering www.domain.com to be redirected to bar.domain.com. That is a simple redirect, no problem.
However I also want to be able to access subfolders of www.domain.com, is there a way the .htaccess file ...
OK, so we were working in the wrong directory, meh!
We have a .htaccess file that is setup to redirect some files to a php script. Now we are adding some hard files which we want to bypass this redirect. So far this does not seem to be working and we are stumped.
Below is our initial .htaccess file contents after starting the engine wh...
Hey guys, I'm trying to implement one of the answers I got to another question I asked on here a couple days ago. You can find the original question here: http://stackoverflow.com/questions/1515639/modrewrite-clarification-question-only-for-dynamic-urls
The most helpful answer and the one I'm modeling the implementation after is as fol...
What's the difference between .htaccess and .htprotect, and will mod_rewrite 301 redirects work if placed in .htprotect?
Thanks for any help.
...
I have the following URL:
http://somedomain.com/aa/search/search.php
I want it to return 2 selections, that of "aa" and that of "search/search.php".
With the help of Regex Coach, I have made the following regular expression which targets these two just fine:
/([a-z]{2})/(.*)
However, when I use them in my htaccess file, the rewrit...
I'm trying to rewrite an url from:
http://domain.com/aa/whatever/whatever.php
to
http://domain.com/whatever/whatever.php?language=aa
However, depending on existing $_GET variables, it either has to be ?language or &language.
To do this, I use 2 regexes with the [L] flag:
RewriteRule ^([a-z]{2})/(.*\.php\?.*) /$2&language=$1 [L]
Rewri...
Currently I have a .htaccess file within the directory of the folder I want to restrict, with the appropriate group that has access to it.
What I want to do is have one htaccess for the entire site, and restrict groups to specific URL's.
So I want staff to have access to:
/staff/..
and Students to have access to:
/students/..
I wou...
.htaccess:
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteCond %{HTTP_HOST} ([^.]+)\.example\.com
RewriteCond %{REQUEST_URI} !^/index\.php$
RewriteCond %{QUERY_STRING} !^id=.
RewriteRule (.*) /index.php?id=%1 [L]
Expected behavior:
If there is a subdomain (test.example.com) it goes to the folder /service/ and if there isn't it g...
can somebody help me optimize this .htaccess file, it feels like the website takes a bit longer to open then it should, I must be missing some rewritecond'itions ...
here's the file contents:
AuthUserFile /usr/www/secure/.htpasswd
AuthName "Pre Launch Test Area"
AuthType Basic
RewriteEngine On
Options -Indexes
RewriteCond %{REQUES...
Hi all,
I'm trying to remove the index.php from the URL, which is working with the .htaccess examples found on the EZPublish site and ForceVirtualHost=true. The problem is that the old links that point to index.php are no longer working (which is problematic when linking from search engines).
I've tried to find a fix for this in using ...
I have a couple of sites in development, which are linking to each other.
What I'd like to do before they are launched is have any missing files on the live sites redirect to the dev sites.
http://www.example.com/test/here.html
Would take you to:
http://dev.example.com/test/here.html
http://www.example.com/index.html woul...
Hi folks..
My previous server working fine.. Today I changed new server and getting RewriteRule cannot compile regular expression on my htaccess.
How to fix this line.
RewriteRule ^category/([0-9]+)(?:/([^/]+)(?:/([^/]+))?)(?:/([^/]+)(?:/([^/]+))?)?/$ ./category.php?pid=$1&catname=$2&page=$3 [L]
Let me know :)
...
bit.ly has it such that if you do
bit.ly/blah+ it redirects to bit.ly/info/blah
How would the htaccess code look for replicating that (using a plus sign to redirect to a related page)
...
Howdy Guys,
I am doing a painful rewrite of many urls on a website I am currently working on, but I have noticed a small problem:
RewriteRule ^domains/transfer$ ./cart.php?gid=11 [L,NC]
This line with navigate if I go to:
http://my-site/domains/transfer
But it won't work with a trailing /:
http://my-site/domains/transfer/
Is the...
I have a httpd.conf file that looks like this:
Alias /robots.txt /var/www/tech_eval/static/robots.txt
Alias /favicon.ico /var/www/tech_eval/static/favicon.ico
AliasMatch /([^/]*\.css) /var/www/tech_eval/static/styles/$1
Alias /media/ /var/www/tech_eval/static/media/
<Directory /var/www/tech_eval/static>
Order deny,allow
Allow from al...