.htaccess

Rewrite only external requests to a certain URL

I want to rewrite from http://example.com/blah/<something>/<somethingelse> to http://<something>.example.com/<somethingelse>, but only if the request is not an internal redirect. How can I achieve this effect? I know I can use %{THE_REQUEST}, but I can't seem to find any good examples. Thanks for the help! ...

I have the URL www.something.com/HereWeGo, I want to get HereWeGo without the 404 error

Hello, Consider the URL www.something.com/HereWeGo. When someone enters the url, the site shows a 404 error since the directory does not exists. I can parse the URL to get the query and HereWeGo, but cannot stop it from going to a 404 error. How can I achieve it by PHP, if it is possible to avoid .htaccess now Thanks Jean ...

.htaccess error while url forwarding

Hello, Here is the .htaccess entry. what I intended to do is to transfer anyone typing as www.yahoo.com/Hello to www.yahoo.com/index.php?h=hello. Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteRule /index.php?u=$1 Now for some reason it shows me a 404 error when I type in yahoo.com too, I wonder what is wrong. Thanks...

HTTP Authentication if site accessed by IP through .htaccess

Hi all, Is there an easy was to force users to login if they access a page by IP (eg http:// 100.200.300.400/page.html) but not if they access the site through the regular URL (eg http:// site.com/page.html)? I am familar with HTTP authentication and PHP but not quite so comfortable with .htaccess directives. Many thanks for any help!...

how to use htaccess redirectmatch with query_string?

hello... im trying to redirect "search.php?q=somethinghere" to "search/somethinghere/" but I can't do it! I'm trying to send form "<form action="search/" method="get" name="search">" like this but url goes to "search/?q=somethinghere" RedirectMatch 301 ^/search.php?q=(.*)$ http://domain.com/search/$1/ this is also not working. whats th...

Redirect .html but not .html?with=options

I'm currently using an .htaccess to get round a problem with a CMS, nothing major and an htaccess fix is tidy enough. I'm currently using the format... redirect 301 /pictures.html http://www.domain.com/gallery.html The problem though this causes is that the CMS uses pictures.html?vars=here to select galleries and so the redirect break...

Htaccess redirect from 12am to 6pm on a certain date

Hello, I would like to know how I can redirect to a certain page (during maintenance) at a certain date between 12am and 6pm for example. thanks! Jasper ...

htaccess dilemna

Hi, During development, I used subdomain.domain.com and everything worked. Moving to live, the files are under www, but I wanted to use domain.com, and that's making certain functionalities not work as follows. I got a dedicated SSL certificate for domain.com, so I have this in my htaccess, and my SSL works fine: # Redirect www.domain...

.htaccess add hidden php get variable for language selection

I have a multiple language website, and I use a php get variable to set the cookie for the language setting. I have multiple subfolders (http://www.site.com/es and http://www.site.com/de) that each have a respective .htaccess file. When accessing these folders, the .htaccess file does this to "silently" redirect the user and add the ap...

RewriteCond and RewriteRule newbie

I'm taking over a website for a client that is running on a custom built CMS (that I didn't write). I don't mess with .htaccess files usually because a lot of the hosting I do is on IIS, or I used WordPress as a CMS and don't have to worry about messing with the .htaccess file. Here's the contents of the file: RewriteEngine on Rewrite...

How to Redirect Folder with 404 .htaccess - without httpd.conf?

Hello, I have no access to the httpd.conf. How can I redirect the users if the type one folder more like -> http://www.example.com/folder/folder2/ --> redirect 404 to the main page. The users should only have access to this root http://www.example.com/link+custom1+custom2/ and if they type something like that http://www.example.com/lin...

htaccess query_string and rewrite rule

hello guys I'm using this htaccess script to set search.php?q=sometng&type=all to search/sometng/ RewriteCond %{QUERY_STRING} q=(.*)&type=all RewriteRule ^search\.php$ /search\/%1\/? [R=301,L] it works succesfully BUT I GET 404 error! I've tried to put RewriteRule ^search/(.*)/$ search.php?q=$1&type=all it returns Attempting t...

two RewriteRules with www redirect

I have a multiple language website, that uses subdirectories from the root ('/en' for english and '/es' for spanish) for each specific language. Each redirect appends a get variable to the URL, and hides it using a 'P' flag for proxy. My current htaccess file for the spanish subfolder is: Options +FollowSymlinks RewriteEngine on Rewri...

How can I allow only one Fix Folder-Structure with .htaccess? Anything else 301

Hello, how can I allow only one Folder-Structure with .htaccess like that: http://www.example.com/**dynamicword**+FIXEDWORD1+FIXEDWORD2/ the dynamicword is not fix, anything else is 301: http://www.example.com/**dynamicword**+FIXEDWORD1+mistype/mistype/ --> 301 http://www.example.com/**dynamicword**+FIXEDWORD1+mistype/mistype --> 30...

.htaccess: Allow only one Folder Structure - 301 Redirect

Hello, how can I allow only one Folder-Structure with .htaccess like that: http://www.example.com/**dynamicword**+FIXEDWORD1+FIXEDWORD2/ the dynamicword is not fix, anything else is 301: http://www.example.com/**dynamicword**+FIXEDWORD1+mistype/mistype/ --> 301 http://www.example.com/**dynamicword**+FIXEDWORD1+mistype/mistype --> 301...

What Am I Doing Wrong on this HTACCESS file?

Someone please tell me what is wrong with this htaccess rules? RewriteCond %{QUERY_STRING} ^q=(.*)&type=downway1$ [NC] RewriteRule ^search\.php$ /search\/%1\/1\/? [R=301,NC,L] RewriteCond %{QUERY_STRING} ^q=(.*)&type=(.*)$ [NC] RewriteRule ^search\.php$ /search\/%1\/%2\/1\/? [R=301,NC,L] RewriteRule search/(.*)/(.*)/$ /search....

.htaccess: Simple Redirect - Allow only one Folder in htaccess

Hi, I see this question before and want the same thing like elmaso Hello, how can I allow only one Folder-Structure with .htaccess like that: http://www.example.com/**dynamicword**+FIXEDWORD1+FIXEDWORD2/ the dynamicword is not fix, anything else is 301: http://www.example.com/**dynamicword**+FIXEDWORD1+mistype/mistype/ --> 301 http:...

Redirection using .Htaccess file

Iam working on Ubuntu.(Linux) I want to redirect from the page one.php to two.php, which are in a folder 'test' How can i do this, using .htaccess file? Any other setting is needed for this? Or .htaccess redirection will not work for local system ...

Changing file extention using .htaccess

Iam working on Ubuntu.(Linux) I want to display all .php pages to .html in the browser, using .htaccess. Where all php files are in the folder 'test' e.g one.php should be one.html like and all other files too ...

.htaccess for displaying the .html files

I have three files in a folder 'test' one.php two.php print.html And i have .htaccess file in the same folder RewriteEngine On RewriteBase /test/ RewriteRule ^(.+)\.html$ $1\.php [L] if we take the print.html in browser , there will be error , because of .htaccess file, for there is no 'print.php' page How can we solve it , by ...