I saw duplicates on this title but to be frank i’m new to PHP and not sure how htaccess works. I had this script purchased from someone and i am not getting help from that developer which is why i’m the only one to solve this issue.
Issue
My old script was made by me which used to be redirected to http://socialdealers.in/Deals/ and the new script is CakePHP based script which shows everything on the index but i still see the old redirection even after removing those files from the hosting.
Website
http://socialdealers.in
- Sometimes i see the updated script but sometimes it gets redirected
to /Deals/ - Tried to clear browser cache and cookies
- Tried to open from my mobile with a different IP and it works with the new script.
I’m sorry if you guys did not understand what i am trying to say but any help would be appreciated. Some developer told me to ask a question here on stackoverflow and said that its .htaccess problem.
Location 1 .htaccess
public_html/socialdealers.in/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/[0-9]+..+.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}.txt(?: Comodo DCV)?$
RewriteRule ^$ app/webroot/ [L]
RewriteCond %{REQUEST_URI} !^/[0-9]+..+.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}.txt(?: Comodo DCV)?$
RewriteRule (.*) app/webroot/$1 [L]
RewriteCond %{SERVER_PORT} !^445$
RewriteCond %{REQUEST_URI} !^/[0-9]+..+.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}.txt(?: Comodo DCV)?$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
</IfModule>
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
Location 2 .htaccess
public_html/socialdealers.in/app/.htaccess
# Use PHP5 as default
#AddHandler application/x-httpd-php54 .php
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
Location 3 .htaccess
public_html/socialdealers.in/app/webroot/.htaccess
# Use PHP5 as default
#AddHandler application/x-httpd-php54 .php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
EDIT:
Issue Resolved Outside Stackoverflow.
Edited the 3rd htaccess file and changed it to
# Use PHP5 as default
#AddHandler application/x-httpd-php54 .php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
2
Answers
Resolved Outside Stackoverflow.
Edited the 3rd htaccess file and changed it to
Both the links you post direct me to
/Deals/
, which is a login/ signup page. Is this not your goal?(1) If you think the problem is with the
.htaccess
file, can you show the content of your.htaccess
to help us all (including you) resolve your issue. The.htaccess
file is located on your web server, likely in the root folder of your website.An example of a simple redirect in
.htaccess
file looks like this:Another example of redirection using regex on all pages, to force non-www, could look like this:
(2) If you think the problem is with your PhP code, then can you also post more information on how you set up your redirect or simply show some of the code.