The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> HTACCESS file merge, Need help merging two htaccess files
shondel
post Oct 10 2016, 12:53 PM
Post #1





Group: Members
Posts: 2
Joined: 10-October 16
Member No.: 24,881



I am developing a php website. I also have wordpress for blog and event calendar plugin capabilities. I recently moved the hatccess and index.php files for wordpress to the root directory so that the permalinks appear to come from the root. My problem is that the new website also has an index.php and htaccess file. I recently renamed the website to home.php and combined the htaccess files and added a DirectoryIndex line for both home.php and index.php. It works in Internet Explorer, but then when I reload a page on Firefox or Chrome, it gives a page not found.

Internet Explorer displays http://www.mydomain.com/#./page
Firefox and Chrome display http://www.mydomain.com/page

Wordpress HTACCESS(on the root):
# 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
RewriteCond %{HTTP_HOST} ^dancetonightohio.com$
RewriteRule ^/?$ "http\:\/\/www\.dancetonightohio\.com\/" [R=301,L]

New website HTACCESS:
Options +FollowSymLinks +ExecCGI -Indexes

<IfModule mod_rewrite.c>
RewriteEngine On

## uncomment the following line, if you are having trouble
## getting no_script_name to work
#RewriteBase /

## remove trailing slash
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_URI} ^(.+)/$
#RewriteRule ^(.+)/$ $1 [R=301,L]

## turn off index.html, it is for offline mode
RewriteRule ^.*index.html$ index.php [QSA]

## no, so we redirect to our front web controller
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

This is what I combined them as:
DirectoryIndex home.php index.php

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
#RewriteRule ^(.+)/$ $1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

RewriteCond %{HTTP_HOST} ^mydomain.com$
RewriteRule ^/?$ "http\:\/\/www\.mydomain\.com\/" [R=301,L]
# END WordPress
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Oct 10 2016, 02:04 PM
Post #2


.
********

Group: WDG Moderators
Posts: 7,702
Joined: 10-August 06
Member No.: 7



QUOTE(shondel @ Oct 10 2016, 07:53 PM) *

It works in Internet Explorer, but then when I reload a page on Firefox or Chrome, it gives a page not found.

.htaccess directives run on the server, so all browsers should get the same result (unless you do browser sniffing in the .htaccess file, which does not appear to be the case).

QUOTE
Internet Explorer displays http://www.mydomain.com/#./page

The part after the # looks like a hashbang, which is normally used together with javascript/Ajax. Maybe some script causes the browser differences.

I don't dare to advice on the actual .htaccess directives, but none of them seem to redirect to the hashbang URL.
User is online!PM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
shondel
post Oct 13 2016, 12:13 PM
Post #3





Group: Members
Posts: 2
Joined: 10-October 16
Member No.: 24,881



Would anyone know how to properly combine these two htaccess files? Or should my combined file work?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 22nd October 2017 - 02:04 PM