The requested url was not found on this server - php

I have imported a codeigniter application to my server. When I am trying to browse to any other page from index page its showing my url not found error. I have changed my base url in config.php file and my .htaccess file looks like this-
RewriteEngine on
#RewriteCond $1 !^(index\.php|public|\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
# BEGIN Compress text files^M
<ifModule mod_deflate.c>
# AddOutputFilterByType DEFLATE text/html text/xml text/css text/plain^M
# AddOutputFilterByType DEFLATE image/svg+xml application/xhtml+xml application/xml^M
# AddOutputFilterByType DEFLATE application/rdf+xml application/rss+xml application/atom+xml^M
# AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript application/json^M
# AddOutputFilterByType DEFLATE application/x-font-ttf application/x-font-otf^M
# AddOutputFilterByType DEFLATE font/truetype font/opentype^M
</ifModule>
# END Compress text files^M
# BEGIN Turn ETags Off^M
#FileETag None^M
# END Turn ETags Off
Also when I am trying to access the page with this url format-
http://localhost/projectname/index.php/signin?uid=%271441336195
Its accessible.I am running apache server on linux. Any help will be highly appreciated.

in config.php change this
$config['base_url'] = '';
$config['index_page'] = '';
and .htaccess should be
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
Note: Make sure
Uploaded all files(system, application,....)
.htaccess place outside appllication folder

Related

how to enable text compression in laravel/vue project?

lighthouse shows following solution.
I tried this in my .htaccess file. but in net work content-encoding is not displayed. i thied sing g.zip compression
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
# for text compression
<IfModule mod_deflate.c>
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>
I tried this in my .htaccess file. but in net work content-encoding is not displayed. i thied sing g.zip compression
For #vue/cli projects:
yarn add -D compression-webpack-plugin (or npm/pnpm equivalent)
in vue.config.js (create it in root if you don't have it):
const CompressionPlugin = require("compression-webpack-plugin")
module.exports = {
configureWebpack: {
plugins: [
new CompressionPlugin(),
/* other plugins */
]
}
}
Alternatively you could use the existing vue-cli plugin. Read installation and configuration docs.
For vite projects:
yarn add -D vite-plugin-compression (or npm/pnpm equivalent)
in vite.config.js (create it in root if you don't have it):
import viteCompression from 'vite-plugin-compression'
import { defineConfig } from 'vite'
export default defineConfig({
plugins: [
viteCompression(),
/* other plugins */
],
})

.htaccess 500 Internal server Error in wamp

Hi I am getting 500 Internal server Error when am trying to run my code in wampserver which is working absolutely
My .htaccess file is in wamp/www/site foloder and all other code is also in same folder
so should i put site somewhere in .htaccess file because online my code is in root folder
My .htaccess code:
RewriteEngine on
FileETag none
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_URI} /+[^\.]+$
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]
</IfModule>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript
</IfModule>
Apache error is here:
J:/wamp/www/site/.htaccess: Invalid command 'AddOutputFilterByType', perhaps misspelled or defined by a module not included in the server configuration, referer: /site/about/
If you are using apache 2.4, you need to change
<IfModule mod_deflate.c>
to
<IfModule mod_filter.c>
as the output filter has been moved to mod_filter. Then you need to make sure you have mod_filter loaded.

RewriteRule redirecting to index.php

This is something weird.
In a website that I'm working on, which uses Zend framework, there was a requirement to redirect any URLs ending with "/" (e.g., http://test.com/test-url/) to the same URL without the "/" (e.g., http://test.com/test-url).
I added this to the .htaccess file:
RewriteRule ^(.+[^/])/$ /$1 [R=301,L]
For many URLs this is working fine. But for URLs like http://test.com/index/test-url/ this gets redirected to http://test.com/index.php/test-url, which is undesired. Can somebody throw some light on why this happens please?
I know you can complain about the unfriendly URLs like "/index/test", but I need to live with it for now :)
The requirement was to avoid these being seen as duplicate URLs by search bots, which affects SEO as some believe.
Here is the complete .htaccess file:
RewriteEngine On
RewriteBase /
RewriteRule ^(.+[^/])/$ /$1 [R=301,L]
# Some other strange redirections
RewriteRule ^index/$ / [R=301]
RewriteRule ^css/$ / [R=301]
RewriteRule ^js/$ / [R=301]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
# compression
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/atom_xml
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/x-httpd-fastphp
AddOutputFilterByType DEFLATE application/x-httpd-eruby
</IfModule>
This behaviour seems to surface when you have the MultiViews option turned on. Multiviews allows for content negotiation with mod_negotiation. You can turn it off by adding the following in the very top of your .htaccess:
Options -MultiViews
For more information, see the documentation and some more information about content negotiation.
Alternatively you can rename index.php to prettybutterflies.php and change your RewriteRule to:
RewriteRule ^ prettybutterflies.php [NC,L]

.htaccess hotlink protection doesn't work

can you correct & inform me please. My issue is my .htaccess hotlink protection doesn't work. I am on a shared server with .htaccess suppport. (SEO friendly linking works)My domain type is http://www.mydomain.p.ht OR http://mydomain.p.ht
my 2 sources for my trials are:
http://www.htaccesstools.com/hotlink-protection/
stackoverflow
I did not forget to replace mydomain with my real domain
my .htaccess
RewriteEngine On
RewriteBase /
# hotlink protection
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?mydomain.p.ht [NC]
RewriteRule \.(jpg|jpeg|png|gif|css)$ - [NC,F,L]
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# File caching is another famous approach in optimizing website loading time
<FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf|js|css|pdf)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>
#SEO friendly linking
...
...
I also tried
1
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?mydomain.p.ht [NC]
RewriteRule \.(flv)$ - [NC,F,L]
2
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?mydomain\.p\.ht/.*$ [NC]
RewriteRule .*\.(jpg|jpeg|png|gif)$ - [F,NC,L]
Your methods are correct and working fine. Since your have caching enabled for these files most likely http://htaccesstools.com/test-hotlink-protection is showing you cached snapshot of the image. If you really want to test it create a html file on your localhost or some other host other than mydomain.p.ht host and include this line (replace /images/home.gif` with the path of an actual gif file):
<img border="0" src="http://mydomain.p.ht/images/home.gif">
And see if image shows up in browser or not. If you have Firbug network tab opened while doing this you should see Forbidden 403 status for above image.

zend router issue in some directories

I have an uploads directory in public path, but in some projects zend can't understand this is a directory and not a Controller.
when I open this folder, zend shows below error to me:
Invalid controller specified "uploads"
checked .htaccess and have no problem.
this is my htaccess code:
RewriteEngine On
AddDefaultCharset utf-8
Options +FollowSymLinks
<IfModule mod_expires.c>
<FilesMatch "\.(gif|jpg|jpeg|png|swf|css|js|html?|xml|txt)$">
ExpiresActive On
ExpiresDefault "access plus 10 years"
</FilesMatch>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*\.(js|css))$ plugins/smartoptimizer/?$1
<IfModule mod_expires.c>
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*\.(js|css|html?|xml|txt))$ plugins/smartoptimizer/?$1
</IfModule>
</IfModule>
<IfModule !mod_expires.c>
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*\.(gif|jpg|jpeg|png|swf|css|js|html?|xml|txt))$ plugins/smartoptimizer/?$1
</IfModule>
<FilesMatch "\.(gif|jpg|jpeg|png|swf|css|js|html?|xml|txt)$">
FileETag none
</FilesMatch>
#
# If Apache is compiled with built in mod_deflade/GZIP support
# then GZIP Javascript, CSS, HTML and XML so they're sent to
# the client faster.
#
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/x-javascript text/css text/html text/xml
</IfModule>
#enabling gzip----------------------------
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# cache images and flash content for one month
<filesmatch ".(flv|gif|jpg|jpeg|png|ico|swf)$">
Header set Cache-Control "max-age=2592000"
</filesmatch>
# cache text, css, and javascript files for one week
<filesmatch ".(js|css|pdf|txt)$">
Header set Cache-Control "max-age=604800"
</filesmatch>
# cache html and htm files for one day
<filesmatch ".(html|htm)$">
Header set Cache-Control "max-age=43200"
</filesmatch>
# implement minimal caching during site development
<filesmatch "\.(flv|gif|jpg|jpeg|png|ico|js|css|pdf|swf|html|htm|txt)$">
Header set Cache-Control "max-age=5"
</filesmatch>
# explicitly disable caching for scripts and other dynamic files
<filesmatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
Header unset Cache-Control
</filesmatch>
SetEnv APPLICATION_ENV development
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

Categories