.htaccess

RewriteRule to RewriteRule?

I want to write a RewriteRule to another RewriteRule, but I can't seem to get things to work. I'm having troubel with the line RewriteRule ^(eTool/)?(RENDER/\d+/\d+/\d+/\d+\.html)$ render-product?url=$2 [L,NC] in this file: RewriteEngine On RewriteBase / RewriteRule ^(eTool/)?(RENDER/\d+/\d+/\d+/\d+\.html)$ render-product?url=$2 [L...

How can I use .htaccess to redirect a folder on my website to a folder on another website?

I'm trying to have everything in this folder on my website - http://www.mywebsite.com/media/images/* redirect to another website with the same structure i.e. http://www.theotherwebsite.com/XXX/media/images/* using .htaccess ...

How to Redirect Subdomains to Other Domain

What I'm trying to accomplish with htaccess mod-rewrite: Redirect all sub-domains to new domain name w rewrite rule. e.g. test1.olddomain.com ===> test1.newdomain.com test2.olddomain.com ===> test2.newdomain.com test3.olddomain.com ===> test3.newdomain.com This is what I have so far which of course is wrong: Options +Foll...

Best way to get rid of www. and .

I want all traffic to go to: http://www.domain.com http://domain.com | V http://main.domain.com I can use .htaccess or maybe something in PHP, I'm using zend framework. Please note I also have: http://sub1.domain.com http://sub2.domain.com thx ...

How to rewrite to static file only if it exists (.htaccess)

Hello. I would like apache to render %{DOCUMENT_ROOT}/cache/%1.html if %1 is the request path. My whole site is in a sub directory called cache_test and I have the following .htaccess file. But the RewriteRule on line 7 and 11 won't match :(. Thank you in advance for any advance! Kind regards, Nicklas 1 RewriteEngine On 2 Rewrite...

Redirection using HTACCESS is working fine on the server but not on the Sub Domain

Redirection using HTACCESS is working fine on the server but not on the Sub Domain. I used the following HTACCESS code for the redirection task: Options +FollowSymlinks RewriteEngine On RewriteRule ^user/(.+)$ done.php?info=$1 http://site.com/user/123/USA to http://site.com/done.php?info=123/USA Does any changes needed on the Sub Do...

Use .htaccess to give form submissions clean URLs

I'd like to rewrite form submissions to clean URLs, so that example.com/search/go?term=foo becomes example.com/search/foo How do I do this? ...

.htaccess force ssl when not www

I have a site which uses ssl when accessing a subdomain which essentially is hosting the actual app, whereas the front end site is present at www, which I don't want to use ssl. So this would allow: http://www.domain.com but if somebody types: http://secure.domain.com they get forced to: https://secure.domain.com which when usin...

How can i get my htaccess to work (subdomains)?

I'm sorta a noob at these things but I'm trying to make a simple virtual subdomain with .htaccess. I have wildcard enabled and after lots of digging, this is what I've come up with: rewriteEngine On rewriteCond %{HTTP_HOST} !^$ rewriteCond %{HTTP_HOST} !^(www\.)?khpedia\.com$ [NC] rewriteCond %{HTTP_HOST}<->%{REQUEST_URI} ^(www\.)?([...

.htaccess redirect https to http not working

I am trying to catch any https traffic to the front of my site so: https://www.domain.com is redirected to: http://www.domain.com However other subdomains need to be redirected elsewhere. For the most part this is all working, apart from the https -> http redirection. Here's my .htaccess file at the moment: RewriteEngine On Rewri...

Using .htaccess to change my website URLs

I have some pages organised like this: http://localhost/index.html http://localhost/download.html http://localhost/contact.html And I need them changed to suit the following URL structure: http://localhost/ http://localhost/download http://localhost/contact Without making sub directories and putting in pages as index.html. As far a...

Using htaccess rewrite to make a subdirectory be its own root for root relative path requests

Can I use htaccess to capture requests from a certain subdirectory and make that directory use itself as the root directory for any root relative path requests? For example if I have... http://www.example.com/subFIXED/subANY/restofpath ...where subFIXED is always the same directory, subANY is any immediate subdirectory of subFIXED, an...

Mod_rewrite not working properly

I have this in my .htaccess file... RewriteEngine on RewriteRule ^/invite$ /invite.html It's meant to let a user access this url: http://mysite.com/invite and display the invite.html page. I don't want to redirect the user, but just show them the invite.html page from a better looking URL. When I browse to http://mysite.com/invite...

Can host be extracted from referer in mod_rewrite for htaccess / apache?

I'm trying to do a rewrite where I need the host part of the HTTP_REFERER. So if the referer is e.g. http://www.example.com/some/path I need to extract the host part, www.example.com and use it in the RewriteRule, so that it rewrites to /some/serverpath/www.example.com/subfolder. Is this possible? ...

How to deny ajax PHP files from browser

There is AJAX script on my WS. Is there a method to deny straight access to ajax php backend? And to access to it only if it is run from my ajax code ...

RewriteRule - take all urls with dash

I need to redirect all urls with dash to a specific page. For example: site.com/this-url to site.com/page.php?url=this-url RewriteRule RewriteRule ^(.+-.+)$ page.php?url=$1 just hang http. No response. What is wrong and how it can be done? ...

.htaccess Error, While modifying php configuration

If this is not posted in correct place, please migrate it I kept a .htaccess file in my public_html folder inside the root. When I view the website it is giving server misconfiguration error. my .htaccess file contains this only php_value upload_max_filesize 100M php_value post_max_size 100M I wonder what may be wrong. Any Ideas MY...

Mod_rewrite causing 404 error

These are the .htaccess files from two of my localhost sites. Virtual host 1 (mysite1.com): # this is the initialization Options +FollowSymLinks RewriteEngine On # Turn on the rewriting engine RewriteRule ^news-07/?$ news_01_06_2007.php [NC,L] # Handle requests for "news" RewriteCond %{REQUEST_FILENAME} !-s RewriteRule ^(...

Little mod_rewrite problem

I have a classifieds website. Each classified is linked like this originally: mydomain.com/ad.php?ad_id=Bmw_M3_M_tech_113620829 What RewriteRule should I use to make this link look like: mydomain.com/Bmw_M3_M_tech_113620829 Also, what do I need to add to my .htaccess file? This is what I have so far: Options +FollowSymLinks ...

Very simple mod_rewrite questions

1- Does mod_rewrite means that if I make this url: domain.com/ad.php?id=8498292 INTO domain.com/8498292 that all links on my website will have to be changed to the later above? example the link: domain.com/ad.php?id=8498292 wont work now, unless I replace it with domain.com/8498292 ? Or will the server know that they are the s...