I need to convert English URL to Spanish URL. I have tried URL re-write management, but that does not help me.
Following URL will show how to do URL re-write.
http://blog.beetleweb.com/2012/10/creating-custom-magento-url-rewrites/
My objective is to convert
URL
www.example.com/customer/account/create
to
www.example.com/cliente/cuenta/crear
Do I have to create a new store for this, or this can be done without creating a store?
Magento solution:
(the code below is not tested, it's just a beginning way of resolution)
Create a custom module for rewrite Magento customer URL.
In your app/local/MyNameSpace/MyModule/etc/config.xml, you can have
something like this :
<frontend>
<routers>
<customer>
<use>standard</use>
<args>
<mynamespace_mymodule before="Mage_Customer">MyNameSpace_MyModule</mynamespace_mymodule>
<frontName>cliente</frontName>
</args>
</customer>
</routers>
<frontend>
Apache2 solution :
(the code below is not tested, it's just a beginning way of resolution)
Use Apache2 rewrite url rules, in .htaccess file in root directory for example.
Your .htaccess file seems like something like this :
RewriteEngine on
RewriteRule ^/customer/([a-z0-9\-]+)$ /cliente/$1 [L]
Related
How can I redirect all the visitors to a different file extension. Example:
Visitor trying to access: http://www.anywebsite.com/0001.jpeg but redirect to http://www.anywebsite.com/0001.pdf. There are thousands of files in one directory with such redirect. How can i redirect all files using a single code in .htaccess ??
This maybe a possible duplicate question but you can find it easily via search
# change file extensions
RewriteEngine on
RewriteRule ^(.*).jpeg$ http://domain.tld/$1.pdf [R=301,L]
Review this link for further explanation:
https://htaccessbook.com/add-remove-change-file-extensions-htaccess/
I have a webpage with a bunch of download links and a name before each download link, the format of the webpage looks like this:
File One's name
direct download link here
File Two's name
direct download link here
and so on.
Is it possible to write a program so it mass downloads all the links on the page with each one being named the names above their respective link? What can I use in order to write something that can this?
I would recommend writing a scraper in python using the scrapy framework.
Using this framework you will be able to extract all of the links from the page and pass them to a media pipeline in scrapy, this media pipeline will allow you to download and save the files with custom names (For example the name above the link).
It's a lot to take in if you haven't programmed, used python or used scrapy before but there are loads of tutorials out there to help you.
Good luck!!
You can initialise a variable for Name of your download file at first.
$filename = "XYZ";//File Name
And at the download function you can call that variable name so that it will be the name of your downloaded file.
//header info for browser
header("Content-Type: application/xls");
header("Content-Disposition: attachment; filename=$filename.xls");
header("Pragma: no-cache");
header("Expires: 0");
In this the downloaded file will be named as XYZ with extension .xls
I'm following the HTTrack docs example here: http://httrack.kauler.com/help/User-defined_structure
The site I need to scrape has URLs in this structure:
https://www.example.com/index.php?HelpTopics
https://www.example.com/index.php?MoreHelp
etc.
With HTTrack, I want to download the site save the files in the format
HelpTopics.html MoreHelp.html etc.
I'm using this on the command line modified from the docs linked above:
httrack "https://www.example.com" %n%[index.php?:-:::].%t
but I still get all files saved as index2b26.html and index2de7.html etc.
What am I doing wrong with the HTTrack options? Is this breaking because there are no file extensions on the original site example.com?
I found it's much easier to use wget to save file with their original names. This does it:
wget --mirror -p --convert-links --content-disposition --trust-server-names -P examplefolder http://www.example.com
From the link, the param in %[param:before:after:empty:notfound] is supposed to be a variable in a GET query. Since your URL does not have a variable, I think the default filename would've been right.
I want to prevent all subdirectory listings and redirect to index page instead.
Folder structure is the following:
/images
/images/folder1
/images/folder2
/images/folder3
/images/folder4
etc.
The number of folders is not predefined. I want to place .htaccess file in /images folder to provent /images/folder1, /images/folder2 etc. listing in browser.
I have not found the sollution. I have just found how to prevent listing using
Options -Indexes,
but no idea how to redirect to homepage (for all subfolders).
When it was predefined number of folders, I simply put index.html with redirection inside those, but now the number of folders is dynamic.
EDIT:
I have already looked into google searching something like "RewriteRule example redirect all subfoldres to homepage" and similar.
For example:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^folder1.*$ http://example.com/folder2/ [R=301,L]
However, I have not found the solution with dynamic folder (if I do not know the exact name of folder, but I need to take all subfolders).
As I am new to htaccess writing it seems tricky for me.
I believe this should work for you in images/.htaccess:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.+$ / [R=301,L]
It redirect every request from images folder which is for any directory but not for a file to your home page /
Modify your .htaccess file to prevent indexing like this:
Options -Indexes
The folders won't be shown.
I'm currently hosting my files on a local server while i build my site. I have my files organised in a way such as this:
images
image1.jpg
image2.jpg
about
index.html
I want the index.html file to be mywebsite.com/about, but when I click the link to it, it goes to mywebsite.com/about/, with a slash on the end like so. How can I get rid of the last slash? Am i organising my files incorrectly?
That is the way it is supposed to work. You are referencing the directory, not a file. When you enter http://mywebsite.com/about, the web server looks for a file called "about" in the root. If it doesn't find it, it looks for a folder called "about." If it finds one, the URL will always end in a slash.
If you really want to have the url end without a slash, you'll need to do one of the following things:
Create a file called "about" in the root directory (that your web server knows to handle with the correct handler and mimetype)
Use an .htaccess file to rewrite the url, something like:
RewriteRule ^(.*)/$ $1 [R=301,L]
You can add the following to your .htacces file:
# remove trailing slash
RewriteRule ^(.*)\/(\?.*)?$ $1$2 [R=301,L]
I hope this helps.