.htaccess file is not working properly on Godaddy server

51
March 14, 2019, at 11:20 PM

I have hosted my folder on godaddy linux cpanel. Wordpress files are in inside /public_html/tma.

I am facing strange issue that my .htaccess file is not working properly.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

When I request for this wordpress folder, http://{myip}/{uniquestring}/tma/ then even if it has index.php, it displays 404 error

Answer 1

WordPress recommends this for if your files are in a subdirectory:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !^/my_subdir/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /my_subdir/$1
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ my_subdir/index.php [L] 
</IfModule>
Answer 2

Just try adding AllowOverride All in your .htaccess File.

Thanks.

READ ALSO
How to make dynamic url with multiple vars like in Laravel?

How to make dynamic url with multiple vars like in Laravel?

How to make dynamic url with multiple vars like in Laravel in my own small MVC? Like when I write Route::get('/post/$1/$2', 'PostsController@showUserPosts')How do you approach this?

47
Yii2 - cannot add foreign key constraint

Yii2 - cannot add foreign key constraint

I am coming from the Laravel worldI know that foreign keys are necessary for relations to work correctly

22
PHP command in Bash does not execute code

PHP command in Bash does not execute code

Ok, so I have a problem with this thing I found on a MacBook AirIt's called terminal and you can do crazy stuff on it

57
Empty Post Data

Empty Post Data

So I'm working on a PHP projectToday wanted to start working on it again

23