I've tried searching multiple previous threads on setting up url rewrite correctly for a Silex application on XAMPP, but still can't figure this issue out. Here is what I am trying to accomplish.
I am using XAMPP and here is the structure of my htdocs folder:
- xampp
- htdocs
- app1
- app2
- app3 <silex application>
.htaccess file (outside of web folder)
- web
index.php file
I can currently do http://localhost:50000/msk/web/cte. My question is how do I get rid of "web" from this (i.e. http://localhost:50000/msk/cte)
I feel like I'm missing something minor, but I can't figure it out.
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /msk/web/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
</IfModule>
LoadModule rewrite_module modules/mod_rewrite.so is un-commented in my config.
I am not using virtual hosts either.
Thanks
Try this one
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
You can try :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /msk/web/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
RewriteRule ^cte/url-word$ cte/redirect-page [L]
</IfModule>
use the following .htaccess in /msk directory:
Options +FollowSymLinks
IndexIgnore */*
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/(web)
# ------- browser looks for them on base url -------- ex: /images/logo.png
RewriteRule ^css/(.*)$ web/css/$1 [L]
RewriteRule ^js/(.*)$ web/js/$1 [L]
RewriteRule ^images/(.*)$ web/images/$1 [L]
RewriteRule (.*) /web/$1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /web/index.php
</IfModule>
and use this .htaccess in your /msk/web directory
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
</IfModule>
Related
I am setting laravel 5.6 in a subfolder but it is giving error the page is not redirecting properly. I have tried everything with the htaceess. I have setup the htacess at the root folder as well as the public folder but it is not working
My root htaccess is
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
and here is my htacess for public folder
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /charity-frontmode/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]
Please help! Thanks in advance
Try the following
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
To start, I am hosting my website on AWS. I have a normal WordPress site in the root, with a custom application in a sub-folder. The Htaccess in the sub-folder is:
//Htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
And the Htaccess in the root:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
I have a feeling WordPress is screwing up my application in /sub/, cause it was working before I moved Wordpress to the root. If you need additional info, let me know. How do I get Wordpress to ignore that directory?
You need to add default htaccess for root directory of wordpress site.
Read out the documentation here for basic , subdomains , multisite etc.
# 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>
Place this htaccess in sub folder.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
i use /%post_id%/%postname%.html in my wordpress permalink.
404 eror dont work for this permalink if post or page not exist.
but for another link 404 work good.
this is my htaccess file :
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
thanks for your help.
Check this might be help you
set apache to "AllowOverride All"
mod_rewrite is present, .htaccess looks like this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wikiarr_prd/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wikiarr_prd/index.php [L]
</IfModule>
# END WordPress
Permalinks structure:
/%postname%_%post_id%.html
I have just installed wordpress on a site. However, I have some standalone php files that I use for analyzing database data on the site that now return a 404 when trying to access them.
For example:
www.mywordpresssite.com/myscripts/myscript.php
This returns a 404.
Here is my .htaccess:
# 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>
Is there any way I can achieve normal access to the said directory/file but without upsetting the current functionality of Wordpress?
Thanks a lot
Change your .htaccess file to this
# 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>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/myscripts/(.*)$ [OR]
RewriteRule ^.*$ - [L]
</IfModule>
I developed an application in a subfolder of my website and it worked fine.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|swf|uploads|js|css|robots\.txt)
RewriteRule ^(.*)$ /app/index.php/$1 [L]
</IfModule>
This file was working fine so and index.php was not required to navigate within the application. Now I moved the application to root of website and changes the last line to
RewriteRule ^(.*)$ index.php/$1 [L]
Now I have start getting Internal Server Error 500. I am not sure that it is something I have done or the .htacces is required to be configured differently. It might be an issue with host too, but I want to exhaust my options first.
Any help will be appreciated. Thanks in advance.
if you in root of hosting you just need
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|swf|uploads|js|css|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
if you site in folder /foo you need:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /foo
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|swf|uploads|js|css|robots\.txt)
RewriteRule ^(.*)$ /foo/index.php/$1 [L]
</IfModule>
if still not working try this, for me it works all over:
RewriteEngine On
RewriteBase /foo
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /foo/index.php/$1 [L]