uploading files with mod_rewrite enabled - mod-rewrite

I have a weird problem. I'm using Uploadify to let users upload their Avatar. My .htaccess file looks like this:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteBase /
RewriteRule ^profile/([^/]*)$ /mysite/profile.php?a=$1 [L]
RewriteRule ^([^\.]+)$ /mysite/$1.php [NC,L]
</IfModule>
When I visit my page like this:
http://localhost/mysite/profile.php?a=avatar the avatar is uploaded fine.
However, when I try this:
http://localhost/mysite/profile/avatar I keep getting a HTTP error and nothing happens.
So I think this has something to do with the Mod_rewrite rules.
Anyone ever had the same problem before?
Thanks in advance.

Related

How to solve 404 error after deploying laravel in server under subfolder?

I have uploaded a laravel project in server inside a subfolder under public_html directory.
For example www.xyz.com/subfolder.
Bot I am getting error 404 NOT Found.
My htaccess code
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
So, I've been fiddling a lot with VirtualHost(s), but the best solution I found does not involve them at all, and here it is.
First thing to do is to configure .htaccess files for both the app's root folder and its public folder. I found a simple working .htaccess file in this answer, which I report here:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
The default .htaccess works fine, instead, for the public folder.
The last step is to correctly configure your routes in routes.php. The workaround which works for me is quite rough, and maybe one could find some more refined solution, but still here it is.
// Get base (root) route
$base_route = basename(base_path());
Route::get($base_route, function () {
return view('welcome');
});
Route::get($base_route.'/myRoute', function() {
return view('myRoute');
});
So basically you need to prepend $base_route to every route in your app.

Codeigniter Project Not Working on localhost

I want to run the codeigniter project which I am currently working on in localhost I setup each and everythng accordingly
$config['base_url'] = 'http://localhost/site';
$config['index_page'] = '';
its works fine in my office but when i bought it home to work more on off days I started getting errors it only shows the home or index page and when i navigate to other pages it displays 404 object not found
just displays the home page all the other routes not working
please help
Reasons can be
You might have copied the code in different CodeIgniter version.
Some code standard differs from version to version.
Might be because of database.
Create .htaccess file and put below code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

Flask .htaccess for FastCGI

I am trying to get my Flask application working on Hostgator shared account. I am having troubles with getting a right configuration of mod_rewrite rules. My dispatch.fcgi appears as a part of URL e.g. www.example.com/dispatch.fcgi/news/. How can I fix it?
Here is my .htacess:
RewriteEngine On
AddHandler fcgid-script .fcgi
RewriteRule ^(dispatch\.fcgi/.*)$ - [L]
RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
I tried many variants none of them works for me.
Found a solution. Now it is in the Flask documentation. Check the "Configuring Apache" section.

Magento 404 Error in frontend after upgrading 1.4.1.1 to 1.6.1.0

I upgrade my magento store 1.4.1.1 to 1.6.1.0 following instruction from this link. Upgrade was successfully done. My Magento backend is working fine. But while I checking front end I got 404 error.
I tried various advice in Google. But none of them helps me.
If you have previous experience in this please share.
Edit :-
I think this problem is occurred due to multi store setup.so i share two table structures
core_store
core_store_group
Core_website
I found the problem myself:-
In "core_store" table some of the stores was disabled.While activate the all stores the problem is solved.
Clean the cache, rebuild catalog url rewrite index, check .htaceess and mod_rewrite
I had this same problem recently.
Check to see if any modifications of the root index.php file have been overridden by the upgrade.
You probably updated the $mageRunCode depending on what url you come to the site on, this will have been replaced by a default index.php file with the upgrade.
i have similar problem and i tried all solution above and also from google but its not solve the problem in the end i tried one solution that is in .htaccess file in root directory
############################################
## rewrite everything else to index.php
RewriteRule .* index.php [L]
</IfModule>
#########
i just comment the above line like
#RewriteRule .* index.php [L]
and then add this code
####
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /magento/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
this will fix my problem and then all categories page and products page are opening perfect and no more 404 error or forbidden error comes. just posted it might be its help others

My mod_rewrite won't work, what's wrong?

I have the following rewrite rule, but nothing is hapenning at all when I try to use it. I have the file in the directory server.blahblahblah.com/todo and the following is my .htaccess file:
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteBase /
RewriteRule ^tasks/view/([0-9]+)?/$ controller.php?task=view&id=$1
RewriteRule ^tasks/view/([0-9]+)\.xml$ controller.php?task=viewxml&id=$1
RewriteRule ^tasks/new?/$ controller.php?task=new
RewriteRule ^tasks/delete/([0-9]+)?/$ controller.php?task=delete&id=$1
RewriteRule ^tasks/completed/([0-9]+)?/$ controller.php?task=complete&id=$1
RewriteRule ^tasks?/$ controller.php?task=home
Does anyone know why this won't work at all?
Thanks,
Tim
If nothing happens at all, it might be that you didn't enable .htaccess files for your site. To do that, change your site configuration (/etc/apache2/sites-enabled/<yoursite>) to include AllowOverride All instead of AllowOverride None (the default). But mind the performance disadvantage - you could also put the rules directly in the site configuration.
In case that doesn't solve it, look at the Apache logs in /var/log/apache2/*.

Resources