开发者

Redirect cgi-bin directory

My Old site had a lot of urls using the cgi-bin directory eg : www.website.com/cgi-bin/etc?123

Now the site is now on a new server running wordpress, and I want to redirect this to : www.website.com/etc/123

The problem is I am getting 404 errors that are not being processed by wordpress, and even creating a direcotry cgi-bin does the same thing.

I am not too sure if I can do this via .htaccess Or is this to do with a PHP.ini setting or even apache?

How can I URL redirect the cgi-bin? As cgi-bin is no longer being used, and nows it is being handled vi开发者_JAVA技巧a wordpress.

Thanks


You can create a symbolic link from cgi-bin to the new destination:

ln -s cgi-bin etc

Review the man pages for "ln" for a full treatment of that command. If you don't have shell access, your web server front-end (e.g. cPanel) can probably create such links.

That said, a redirect of cgi-bin is probably not a good long-term solution, given cgi-bin's special significance and handling by the web server. Use a redirect to keep things running while you work through updating the paths in Wordpress, then remove the redirect.


If you have mod_rewrite available and I've correctly understood what you wanted, you can redirect the cgi-bin URLs to the new URLs with the following rule set:

RewriteEngine On

# Check the query string for a number (you might need to adjust
# the regex to match your data appropriately)
RewriteCond %{QUERY_STRING} ^(\d+)$
# Perform the redirect to the new URL if the current URL starts
# with cgi-bin/
RewriteRule ^cgi-bin/(.*)$ /$1/%1? [R=301,L]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜