HTACCESS file merge, Need help merging two htaccess files |
HTACCESS file merge, Need help merging two htaccess files |
shondel |
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 |
Christian J |
Oct 10 2016, 02:04 PM
Post
#2
|
. Group: WDG Moderators Posts: 9,722 Joined: 10-August 06 Member No.: 7 |
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. |
shondel |
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?
|
Lo-Fi Version | Time is now: 27th September 2024 - 02:02 AM |