I have no IIS installed, and I need to convert my htaccess file to web.config
How to make ..
Best Regards !
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^p/(.*)$ index.php?rqt=page/index/url/$1 [NC,L]
RewriteRule ^(.*)$ index.php?rqt=$1 [NC,L,QSA]
You could not change the .htaccess file. Because it is present in Apache base Web-hosting server. If you are using the ASP.NET or ASP.Net MVC. Then you could not host it on the Apache Server. You could be a move to the IIS server hosting.
But, you still make the adventure to do this then move on to the ASP.Net Core 2.0 or latest version. In this, you may have some sort of changes in your Controller. For .Net Core Application, you will have the appsetting.json file. Which you can run Nigix, Apache, IIS, and Kestrel, etc.
After all, I prefer you to use the IIS Server or having the hosting server which uses the IIS environment.
Related
I'm using a shared hosting service that always has Apache web server running, so I can't run my Node.js application directly on port 80. Instead, as I've been told by my host, I need to use .htaccess to redirect incoming requests to my Node.js app, which is currently running on port 50000. Here's the .htaccess file they told me to use:
RewriteEngine On
RewriteRule ^$ http://127.0.0.1:50000 [P,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://127.0.0.1:50000/$1 [P,L]
This works well enough, except that when I try to go to mydomain.com, the Node app is seeing a request for /index.php. The tech support for my host seems to be as confused as I am. If I go to mydomain.com/test then Node.js app sees /test, so Apache seems to only be adding index.php on the root URL. Could this be an Apache caching issue from someone accessing the URL prior to the .htaccess file and Node.js app being set up?
UPDATE
At this point, no one seems to have a clue what is going on, so I'm just going to add an 'index.php' route to my Node app. Thanks to everyone who took a look and tried to help out.
You might have DirectoryIndex set up for index.php in apache conf file which may be the reason you are getting index.php automatically, what you can do is to set DirectoryIndex to some filename which may not exist or if it is apache 2.4 use DirectoryIndex disabled in your .htaccess.
This is actually what you are going to want to put in your /public_html directory
In the .htaccess file in the code below you will see
http://127.0.0.1:50000
(50000) is the port you are sending it too. There are 2 spots where you make that update.
Also update the example.com
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://example.com/$1 [R,L]
DirectoryIndex disabled
RewriteEngine On
RewriteRule ^$ http://127.0.0.1:50000 / [P,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://127.0.0.1:50000 /$1 [P,L]
This is a specific configuration for an apache server with nodejs.
I'm currently developing some websites with Node.js, but when I take it offline for maintenance etc. it shows me a 503 (an ugly one...)
It's on a host where I can run Node.js on given port (doh) and I need to place an htaccess file with a redirect to that port in the apache folder.
I've been googling a while, and I can't find it... Help?
.htaccess:
RewriteRule ^$ http://127.0.0.1:*portno*/ [P,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://127.0.0.1:*portno*/$1 [P,L]
It's a shared hosting account with SSH access.
Apache Version 2.2.29
cPanel Version 11.48.0 (build 13)
I use .htaccess rewrite rules to redirect urls with the extension .html to .php.
These are my current rewrite rules:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)\.html$ a/$1.php [NC]
How do I get these to work on IIS6?
Apache (which is the web server in XAMPP) .htaccess (mod_rewrite) rules won't work on IIS6. You need to install a third party rewriter such as HeliconTech's ISAPI_Rewrite to achieve this.
IIS7+ supports rewriting out of the box but the format is different.
I've been trying to solve a problem for the past few hours. I am desperate for help!
I have two domains:
rd1.example.com/drupal
rd2.example.com
I have a drupal installation in rd1.example.com/drupal/
Further, I started creating content on drupal in a url alias: rd1.example.com/drupal/rd2/
What I want to do is used the second website to point to that specific content within my drupal installation:
rd2.example.com -> rd1.example.com/drupal/rd2/
I don't want it to be a redirect but an internal hidden redirect. The user will think that they are on rd2.example.com.
I've switched rd2.example.com to point to the directory where drupal is installed. I've been trying to edit the rewriterules on drupal's .htaccess but with no luck. Any help is greatly appreciated. Here is my rules so far:
#Existing settings
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} !^rd2\.example\.com [NC]
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]
#New rules to accomodate for rd2.example.com
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} ^rd2\.example\.com$ [NC]
RewriteCond %{DOCUMENT_ROOT}/rd2%{REQUEST_URI} -f
RewriteRule .* /rd2/$0 [L]
Drupal relies on the server variables to process its request. That means when you internally rewrite to /rd2/$0, drupal doesn't know what to do with that. You'll need to reverse proxy *from the rd2` subdomain instead. So leave drupal the way it is, then on the rd2.example.com document root, add:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^rd2 [NC]
RewriteRule ^(.*)$ http://rd1.example.com/drupal/rd2/$1 [L,P]
This will only work if you have mod_proxy loaded on your server, otherwise nothing will happen. Mod_proxy can only be turned on through your server's config. You could also setup the reverse proxy from the vhost config for the rd2 subdomain:
ProxyPass / http://rd1.example.com/drupal/rd2/
Beside of proxy, you may also consider to use a symbolic link that made by a shell command like so:
ln -s /path/to/rd1 /path/to/drupal/rd2
More details is explained in Multi-site - Sharing the same code base
I'm running a project site that has a zend framework in one folder, and a Project Pier (sort of Basecamp) install in a completely different folder (because it was installed way earlier, initially running from another domain).
The domain I registered for this project redirects to the zend/public/ directory with the following rule in my root folder:
RewriteCond %{HTTP_HOST} ^www.visiondating.nl$
RewriteRule ^(.*)$ files/zend/public/$1 [L]
This works fine, but then I figured I wanted the Project Pier page to be accessible from the same domain even though it's running from a completely different location on the server. So I wrote this:
RewriteCond %{HTTP_HOST} ^www.visiondating.nl$
RewriteCond %{REQUEST_URI} ^/project
RewriteRule ^(.*)$ cria/$1 [L]
RewriteCond %{HTTP_HOST} ^www.visiondating.nl$
RewriteCond %{REQUEST_URI} !^/project
RewriteRule ^(.*)$ files/zend/public/$1 [L]
What I'm trying to do here is redirect visiondating.nl/project/index.php to root/cria/project/index.php (where Pier is running), and redirect all other traffic on that domain to Zend.
What am I doing wrong?
You could just run Project Pier on pier.visiondating.nl. It's easy enough to make RewriteConds filtering that.