I am trying to redirect /folder to / using .htaccess but all am I getting is the Apache HTTP Server Test Page.
My root directory looks like this:
/
.htaccess
-/folder
-/folder2
-/folder3
My .htaccess looks like this:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/folder/
RewriteRule ^(.*)$ folder/$1 [L]
What am I doing wrong? I che...
Typing out the title to this leads me to believe this might not be possible due to security concerns, but I will ask anyway. I have shortcode support running on my server, lets call it xx.yy
I want it so when a user sends a request to xx.yy, it just changes the displayed host to another valid domain running on the same box.
I have thi...
Hey guys,
I'm currently rewriting urls from
http://domain.com/profile/?u=10000017564881
this to this
http://domain.com/profile/10000017564881
with the following rewrite
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*?)\/?$ index.php?u=$1 [L]
However I'd like to optimiz...
I am pretty new to Linux. Got a VPS set up yesterday, installed Apache2, PHP5 and MySQL.
When I do apache2 -l I get this:
Compiled in modules:
core.c
mod_log_config.c
mod_logio.c
prefork.c
http_core.c
mod_so.c
When I do sudo a2enmod rewrite I get this:
Module rewrite already enabled
And rewrite.load is in /etc/apache...
Using a .htaccess rewrite rule, I need to add "?q=" before the path on any URL's containing the word "imagecache"
Therefore, if the URL is:
http://mysite.com/sites/default/files/imagecache/myimage.jpg
...then it will really try:
http://mysite.com/?q=sites/default/files/imagecache/myimage.jpg
But that will ONLY happen if the URL c...
I need to redirect web requests of the form /{language}-{country}/{file} to:
/{language}-{country}/{file} if it exists, otherwise
/{language}/{file} if it exists, otherwise
/en-US/{file}
The existing .htaccess fulfils requirements 1 and 3. What changes do I need to fulfil requirement 2?
.htaccess:
Options +FollowSymLinks
RewriteEng...
I would like to rewrite dynamic URL
/index.php?pid=login&redirect=/previous-page.html
to something like this
/login.html-r-previous-page.html
I tried this
RewriteRule ^login.html-r-(.*)$ /index.php?pid=login&redirect=$1 [L]
But no succes. I was also trying to change the regex to .+ or some other forms, but it seems useless. Maybe ...
I want example.com/23-45 be transformed to example.com?id=23-45
Could you please post the code I should add to .htaccess file to make this work
(Is this everything I should do to make this work - add a piece of code to .htaccess file ???)
Thanks a lot!
...
All the image assets in my Rails application live in /public/images and are served by Apache if they exist on the server. If a request for a missing image is made, Apache can't serve it so it gets passed on to Rails which subsequently raises a 404.
Ideally I would like any request for a missing image to be handled at the Apache level, ...
Hello I have a link on my site with files at the following link: example.com/community/community/ How can I use htaccess to convert the link to example.com/community/ without moving the files from /community/community/
...
I'd like to use $1 in the [cookie] flag of RewriteRule. I want to create a cookie with a part of the request URL as in the following:
RewriteRule ([0-9]*)/*. - [CO=cookieName:$1:example.com]
for example:
If the request url is: http://www.example.com/1234, i want to set a cookie name cookieName with the value 1234
it seems no cookie i...
I'm attempting to use .htaccess in the root folder of an Ubuntu/Apache2 server in order to mask a subdomain to subfolder and I keep getting a 500 Internal Error. I know that I'm doing something stupidly wrong and it is some silly error causing the problem. I've checked all of the similar threads on SO and online and whenever I try their ...
Hi,
I'm a complete n00b when it comes to regular expressions. I need these redirects:
(1)
www.mysite.com/bike.php?id=001&product=Product-Name&source=Source-Name
should become -> www.mysite.com/Source-Name/001-Product-Name
(2)
www.mysite.com/car.php?id=002&product=Product-Name&source=Source-Name
should become -> www.mysite.com/Sourc...
In htaccess with mod_rewrite, how can I read the value of a cookie and then add that value to the URI?
For example, if a cookie named "foo" is set with a value of "bar", I need htaccess to redirect to:
example.com/?foo=bar
or any variation of that URL:
example.com/folder/stuff/things/?foo=bar
...
I have a fairly simple redirect rule setup in my Apache vhost.
<VirtualHost *:80>
ServerName mobile.foo.com
ServerAlias *.foo.com
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.*)\.foo\.com$
RewriteRule ^(.*)$ http://mobile.bar.com/foo [R=301,L]
</VirtualHost>
I want to add another condition based on the request uri...
I have some old indexed pages like:
index.php?action=addon_googlemap_showmap&listingID=XXXXX&popup=1
index.php?action=addon_googlemap_showmap&listingID=XXXXX&popup=yes
and I want to redirect them to new urls:
index.php?action=listingview&listingID=XXXXX
XXXXX is a number.
What should I put in my htaccess file?
Thank you in advance...
Hi guys,
I spend a lot of time trying to figure out what's wrong with this .htaccess rewrite with no success. It produces a "500 Internal Server Error" :(
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/(([^/]+/)*)gallery/
RewriteCond %{DOCUMENT_ROOT}%1gallery/cache/$0 -f
RewriteRule ^.+ cache/$0 [L]
RewriteCond %{REQUEST_FILENAME} !-f...
This is for basic HTML/PHP pages, no query strings, etc.. I have searched high and low and find resources for removing the 'index.php' from the URI, or removing '.php' and other file extensions.. and even adding a trailing slash. But, everytime I try to use them all, or use examples that I have found, I get a 500 server error.
I may pas...
Hi Guys,
I'm really new to apache mod_rewrite module. I have a page called http://abc in my company intranet. I want users to be redirected to http://abc.somecompanyname.com whenever they type http://abc to the URL bar. Could someone please provide and example or point me in the right direction.
I figure this should be quite an ea...
At the moment I have two machines that I do web development on; an iMac for work at the office and a MacBook for when I have to work on the move. They both running OS X 10.6 have the same version of PHP, Apache, etc running on them.
Both computers have the same files of the website, including the .htaccess file (see below). On the Mac...