Htaccess file help
-
Hi, thanks for looking
i am trying (and failing) to write a htaccess for the following scenario
<colgroup><col width="679"></colgroup>
http://www.gardening-services-edinburgh.com/index.html http://www.gardening-services-edinburgh.com
http://www.gardening-services-edinburgh.com/
|
so that all of these destinations goto the one resource
any ideas?
thanks
andy
-
When I try the url mobile.gardening-services-edinburgh.com/index.html it seems it's being redirected to http://mobile.gardening-services-edinburgh.com/Mobile/ which is generating a 302 to the lost page.
Could you try to take out the last 2 lines - they don't seem to work (adding the trailing slash) and I fear that they are generating this issue.
Like most people on this forum I am not really an expert in regex - you could always try to put your question on a forum like stackoverflow - which is much more technically oriented.
Dirk
-
Hi tried that
heres the code for the.htaccess file
the problem is when you goto our mobile.gardening-services-edinburgh.com/index.html it comes up with a missing webpage
however, when you goto mobile.gardening-services-edinburgh.com without the /index.html it comes up with the correct webpage
any ideas?
thanks
#######################################################################
Diese .htaccess wurde vom STRATO-Webservermanager erstellt
#######################################################################
<ifmodule mod_expires.c="">ExpiresActive On
ExpiresDefault A86400Expires after 1 day
ExpiresByType image/gif A86400
ExpiresByType image/png A86400
ExpiresByType image/jpg A86400
ExpiresByType image/x-icon A86400
ExpiresByType application/pdf A86400
ExpiresByType application/x-javascript A86400
ExpiresByType text/plain A86400Expires after 1 day
ExpiresByType text/css A86400</ifmodule>
mod_gzip_on Yes
<ifmodule mod_deflate.c=""><filesmatch ".(js|css|html|jpg|png|php)$"="">SetOutputFilter DEFLATE</filesmatch></ifmodule>Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^gardening-services-edinburgh.com [NC]
RewriteRule ^(.*)$ http://www.gardening-services-edinburgh.com/$1 [R=301,L]RewriteRule ^index.html$ / [R=301,L]
RewriteRule ^(.*)/index.html$ /$1/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*[^/])$ /$1/ [L,R=301]ErrorDocument 401 http://www.gardening-services-edinburgh.com/Error-Lost-Page.html
ErrorDocument 403 http://www.gardening-services-edinburgh.com/Error-Lost-Page.html
ErrorDocument 404 http://www.gardening-services-edinburgh.com/Error-Lost-Page.html
ErrorDocument 500 http://www.gardening-services-edinburgh.com/Error-Lost-Page.html
-
Hi,
Normally these rules should do the trick:
RewriteEngine On
removes the index (source:http://dense13.com/blog/2012/10/29/removing-index-html-with-mod_rewrite-in-htaccess/)
RewriteRule ^index.html$ / [R=301,L]
RewriteRule ^(.*)/index.html$ /$1/ [R=301,L]adds a trailing slash (source: http://stackoverflow.com/questions/21417263/htaccess-add-remove-trailing-slash-from-url)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*[^/])$ /$1/ [L,R=301]Dirk
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Website ranking on Google dropping for unknown reason while rankings are improving on Bing. Please help!
one of my websites www.resumeble.com is showing a constant drop in rankings. Earlier the website was ranking for major keywords like resume writing services etc. I used Ahrefs site audit to find issues. According to Ahrefs there was a huge issue of duplicate pages, which is now resolved by proper canonical tag insertion. The site is built on Angular. Fetch report in Google shows perfect code and Sitemap is also perfect. Manual action reporting in webmaster shows no warning. Please suggest what steps should I take to fix this issue.
Technical SEO | | mayyaa40 -
Robot.txt : How to block a specific file type in several subdirectories ?
Hello everyone ! I need help setting up a robot.txt. I'm trying to block all pdf files in particular directories so I'm using this command. In the example below the line is blocking all .gif in the entire site. Block files of a specific file type (for example, .gif) | Disallow: /*.gif$ 2 questions : Can I use this command to specify one particular directory in which I want to block pdf files ? Will this line be recognized by googlebots ? Disallow: /fileadmin/xxxxxxx/xxx/xxxxxxx/*.pdf$ Then I realized that I would have to write as many lines as many directories there are in which I want to block pdf files. Let's say I want to block pdf files in all these 3 directories /fileadmin/directory1 /fileadmin/directory1/sub1 /fileadmin/directory1/sub1/pdf Is there a pattern-matching rule I could use to blocks access to pdf files in all subdirectories instead of writing 3x the above line for each subdirectory ? For exemple : Disallow: /fileadmin/directory1*/ Many thanks in advance for any insight you may have.
Technical SEO | | LabeliumUSA0 -
Htaccess mod rewrite from server address
Hi there, I'm not massively experienced with creating mod rewrite rules and I'm worried I've got this wrong as its slightly different to what I'm used to. The web dev and content creators were working on http://5.10.105.45/~isea/ to create content. I want to redirect all URL's to www.iseasurfwear.co.uk. This is what I've written //Rewrite to www
Technical SEO | | BlueTree_Sean
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^5.10.105.45/~isea/[nc]
RewriteRule ^(.*)$ http://www.iseasurfwear.co.uk/$1 [r=301,nc] Can anyone tell me if this is correct?0 -
Should I use my competitor's name in my content to help my rankings?
If I have a competitor that ranks higher than me, would it be helpful to use their name in my content, or in my meta information?
Technical SEO | | greaterstudio0 -
Creating a CSV file for uploading 301 redirect URL map
Hi if i'm bulk uploading 301 redirects whats needed to create a csv file? is it just a case of creating an excel spreadsheet & have the old urls in column A and new urls in column B and then just convert to csv and upload ? or do i need to put in other details or paremeters etc etc ? Cheers Dan
Technical SEO | | Dan-Lawrence0 -
Help! Getting 5XX error
Keep getting a 5XX error and my site is obviously losing ranking, Asked the hoster. Nobody seems to know what is wrong. Site is www.monteverdetours.com I know this is probably an obvious problem and easy to fix but I don't know how to do it! Any comments will be greatly appreciated.
Technical SEO | | Llanero0 -
Yoast WordPress SEO settings please help
Hello 🙂 Can you please look at these screenshots of my Yoast WordPress SEO settings http://www.zaslike.com/files/h5149mi5435dspiswfm.jpg http://www.zaslike.com/files/5dlhmjxfh2j0hqswesha.jpg http://www.zaslike.com/files/fmx1pwih240gwiofh86s.jpg http://www.zaslike.com/files/w7tyvlhgr5vhv149b9a.png http://www.zaslike.com/files/l9lo37jfpeqmrpufke8.png are they good ? Do i need to change something or correct ? please help Thank you !!!! :))))
Technical SEO | | wolfinjo0 -
301 Redirect NOT Working as Expected - HELP!
Hi! I just launched our newly coded site and just realized the installed 301 is NOT working. The URL string is the same EXCEPT for the removal of /shop/. Here is the code in .htaccess: ############################################ enable rewrites Options +FollowSymLinks RewriteEngine on #RedirectMatch 301 ^/shop?/$ http://hiphound.com/ RedirectMatch 301 ^/shop?/$ http://hiphound.com ########################################### When I go to Google and click on an old link I get a 404. No bueno!! Here is an example: http://hiphound.com/shop/rubit-dog-tag-clip I thought (and was told) that the installed 301 would send this page to: http://hiphound.com/rubit-dog-tag-clip It's not. Please HELP!! 🙂 What am I doing wrong??? Lynn
Technical SEO | | hiphound0