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...
What I want:
To 301 redirect /file_new.pdf to
/file new.pdf ( %20 aka space between
file and new )
I'm aware that:
I can rely on RewriteRule 301 which uses mod_rewrite, using a solution from this thread: @ http://stackoverflow.com/questions/410811/modrewrite-with-spaces-in-the-urls
I can rename the file to not include spaces...
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 a photo gallery at mydomain.com/photos. I'd like to use RewriteRule to enforce photos.mydomain.com as the URL, but the photo gallery comes with its own .htaccess that declares a RewriteBase of /. I think that this is preventing me from doing the otherwise simple redirect I'm aiming for. How do I do this?
...
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...
www.mysite.com/directory1/directory2/cgi-bin/something.cgi/http/www.hello.com
into
www.mysite.com/directory1/directory2/something/www.hello.com
OR
www.mysite.com/www.hello.com
...
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...
hi,
can that be possible in mod rewrite? for example (mydomainname.com/myadmin) to (myadmin.mydomain.com)? how to write that in mod rewrite? so whenever the access the mydomainname.com/myadmin they get an error message of not existing.
Thanks!
--Edited---------
Sorry for that. In my website I have an admin (/myadmin) section where on...
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...
Im using a mod_rewrite rewrite rule in apache to get access to a tomcat application. This applications is using session cookies.
The application cookies works fine when accessing the tomcat application directly, but if I use the apache url, the cookie will not be sent out by the client browser. I guess this is because there is no match ...
.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...
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 ...
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 :)
...
There is an answer to the question of handling wild card subdomains, but it does not meet all my needs. I need to do all of these, supposing for example that the domain is example.com:
If the domain given is www.example.com it should 301 redirect to example.com because I do not want to have duplicate content that will create problems ...
I'm using Apache rewrite_mod to have all test after the URL adress go into parameter text using the following in the .htaccess file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?text=$1 [L,QSA]
which works if I have www.example.com/some_text
but doesn't when I have www.example.com...
If I go to http://www.example.com I want it to stay there, which is working fine.
If I go to http://bar.example.com it redirects to http://www..com, which is wrong
I want it to go to http://www.example.com given the backreference in the RewriteCond
RewriteEngine On
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www.(exa...
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...
Hi,
I am setting up some rewrite rules on an Apache server using mod_rewrite. I was wondering if it was possible to write a rule that will basically re-direct the user to the home page if the page is not found i.e.
http://example.com/test <-- does not exist
However, I would like if the user was to navigate to this domain they are au...
I would like to have one .htaccess file that can rewrite correctly on both my localhost development environment and on my hosted production site. Right now I have to keep two separate file copies for every site I work on. I would like to be able to synchronize the two sites without blowing away either one of their .htaccess files.
Belo...