I'm working on a PHP web app which will route every incoming request to the index.php same as WordPress or Joomla.
Following .htaccess is used to implement the feature.
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
It is working on Wamp server [Windows] and IIS but when I migrate the app to the Ubuntu 16.04.02 [Apache 2.4.18, php7.0.18, Google Cloud Engine], it stops working for some custom extension file. It still working on normal php files thought.
I created a folder called service to put the web service php files and named the files as ****.svc.php and used with ****.svc url. It was working fine before but it is not on the Ubuntu and shown the following error.
Not Found
The requested URL /service/retrieve_opened_rs.svc was not found on this server.
Apache/2.4.18 (Ubuntu) Server at ******* Port 80
I believe this is the configuration issue but I still cannot figure out how to fix after 3 days. Please help me. Thanks in advance.
You probably have the Multiviews option enabled. This never behaves well along with rewrite rules, especially with "double" extensions like .svc.php
Add this at the top of your .htaccess file and that should take care of it:
Options -Multiviews
You might have to tweak your AllowOverride directive (from the main Apache conf) if you don't have the rights to modify Options from an .htaccess file.
Related
I have migrated my CRM application (developed PHP) from hostgator VPS to hostinger,
My application Folder structure is crm\leadstracer1.1{other php files}. I had kept a .htaccess file in crm folder, to avoid '.php' extension on URL, that was working fine on hostgator. But after migrating hostinger its not getting work, I am using CentOs server, I tried instructions from following links
Linux CentOS 7 - Configuration of httpd.conf file through .htaccess
Codeigniter URL rewriting .htaccess is not working on CentOS
But nothing get work out.
Please see the content of my .htacess file.
RewriteEngine On
RewriteRule ^$ leadstracer1.1/views/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ leadstracer1.1/views/$1.php
It would be great if someoone help me regrding this
Thanks
Have you correctly configured your httpd.conf or virtualhost conf file to allow the use of htacces file?
Usually you have to change it to make it works.
There should be a directive called AllowOverride none that must be configured as All for example
So I have attempted to install Drupal 8.2.4 onto a dedicated server that I own.
I am running WampServer 3.0.4 64-bit with PHP 5.6.19 and MySQL 5.7.11.
I successfully get through the installation wizard and to the main page of the website however when I try to go to various pages, none of them work.
This appears to be an issue with Clean URLs. During the installation I get a warning message that Clean URLs is not enabled.
However, I have checked my apache config and rewrite_mod is enabled.
I tried to manually access the admin page # ?q=admin/config/search/clean-urls however it just returns me to the index page.
I've taken a look over the guide here: https://www.drupal.org/node/15365
I tred modifying my httpd.conf by adding the following to the bottom:
RewriteEngine on
RewriteBase /mms-beta
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]
However, then the server won't start.
I've also ensured that for /www/ the AllowOverride is set to All for the purposes of htaccess.
Can someone give me an idea as to what I need to do to get this to work?
UPDATE: So I tried adding garbage to my .htaccess file and it doesn't break, so its clear my htaccess file is not even being read.
Ok, solved.
You need to add an alias under Apache through the wamp tray icon and then modify the conf file.
In the conf file specify as follows:
AllowOverride All
Then delete:
require local
Now htaccess will work correctly.
I have an application written in Codeigniter 2.1.4 which works on my local machine installed with WAMP.
When moving the project over onto a production server, Codeigniter routing stops working. The login form actions a controller method, but instead I get routed to the home page of the website. The same happens if I manually try to enter any part of the web app, even though I have redirect logic for not being logged in to the app.
My production server has IIS6 installed and IsapiRewrite4.
I've tried copying all the rewrite rules from the .htaccess file that comes with CodeIgniter into an IIRF.INI file but I just can't get it to work.
These are the default .htaccess rules:
RewriteEngine on
RewriteCond $1 !^(index\.php|public|\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1
I've read that you can paste that into an IIRF.INI file and it should work but had no luck with it.
Also, I'm not exactly sure where to put the IIRF.INI file, I was guessing at the CodeIgniter root directory where the other .htaccess is.
I also noticed that there are other .htaccess files, one in the /core folder, one in the /application folder, and one in the /application/cache folder.
Do I need to restart IIS on the production server when changing/adding IIRF.INI files?
I've also tried the rules suggested here with no luck: Configure htaccess to work with IIRF on IIS6 - codeigniter
Can anyone help??? Maybe it's not even a Rewrite Issue, I'm not sure... Please let me know if you need any other information.
Isapi Rewrite is a product by Helicon Tech. Helicon products use slightly different configuration files to Ionic IIRF isapi rewrite module which uses the IIRF.ini files. I think you've got your products mixed up.
See Helicon's documentation at http://www.helicontech.com/isapi_rewrite/
Alternatively Ionic ISAPI rewrite module is available at https://iirf.codeplex.com/
I have the following htaccess file for my website, http://academy.young1.org.
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
However, although it is working perfectly on my local server (localhost) and redirecting to the correct pages despite the '.php' extension not being present in the URL, it is not doing this at all when I load it up to the web server. It is currently stored in the same ftp subdirectory as my main php files, ftp://ftp.young1.org/academy.
I have tried rewriting the httpd.conf file in my Apache directory:
<Directory / "ftp://ftp.young1.org/academy/">
AllowOverride All
Require all denied
</Directory>
but to no avail. Is there a setting I have to change somewhere or additional code I have to place in to make it work? I am currently using a Xampp system on easyspace hosting.
Thanks,
Regards,
Robert Young
First check is you mode_rewrite module is enabled and confirm url rewriting is possible in your server. I hope you have a shered server,if its from godaddy url rewriting is not possible in my knowledge, please contact your customer service. because i have the same issue.
This link will really help you to correct your htaccess
http://coding.smashingmagazine.com/2011/11/02/introduction-to-url-rewriting/
i have windows server 2008(r2) and i installed php and mysql using with Web Platform Installer in that windows.
it seems everything is ok about php and mysql.
now i want to install http://www.phpfreechat.net/ in my server.
after installation i got this error :
mod_rewrite must be enabled server side and correctly configured. "RewriteBase" could be adjusted in server/.htaccess file.
as you know .htaccess file is for linux servers.
what this error mean and how can i fix it?
i think in my server php is working under iis and there is no appache in my serevr, so how can i bypass that error?
i changed the wwwroot permission to EveryOne with no help.
also when i open wwwroot with cuteftp i can not find any permission by right click on every file (properties)
EDIT:
there are some folders in that project like client - server - etc
in server folder .htaccess is like this :
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /path/to/phpfreechat/server
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
<Limit OPTIONS GET POST PUT DELETE>
Order allow,deny
Allow from all
</Limit>
thanks in advance
mod_rewrite is for Apache servers. Here you can see how to use rewrite rules for IIS using the URL Rewriting Module.
You should really read this document on how to create new rewrite rules. I don't know whether it supports .htaccess or not, but I don't think so. Just follow the official documentation.